6 Replies - 828 Views - Last Post: 09 July 2010 - 07:25 AM

#1 Guest_Freddie*


Reputation:

Need help with sql

Posted 15 May 2010 - 04:03 AM

Hi im working on a site and i need help with one thing.
I should be easy but i got a brainfreze...

I want to show a link for my members when they click that link it will popup a little window with cpalead widget and when they have done it will send info to the DB and enter that this user have done a survey and dont have to do it again. And after that a normal link will come when they enter the page again with the download link. It should be easy but i didnt find anything on google. But i did find this forum! So please help me a little.

Is This A Good Question/Topic? 0

Replies To: Need help with sql

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,441
  • Joined: 23-August 08

Re: Need help with sql

Posted 15 May 2010 - 06:08 AM

You've described the whole process and not provided a lick of code, so I'm not sure what you're seeking here. Add a DB field for the user for whether they've taken the survey. When they get to the page check to see if they've taken it. If they've not taken it, redirect to the survey page. When they've taken the survey, change the DB field to reflect that they took it and redirect back to the original page.

Pretty rudimentary web application stuff there.
Was This Post Helpful? 0
  • +
  • -

#3 Guest_Freddie*


Reputation:

Re: Need help with sql

Posted 15 May 2010 - 09:54 AM

Well it's just that i dont wanna give out codes here so people can steal but what ever.

I dont know what code you want? Like the download link is a normal Href="http://mysite.com/download.php?Name.mp3
But i want that to be hidden if the user havent done a survey and i need someone to help me with that to update the table inside the sql DB and i dont know how to add another table inside the "User" Like "Premium" that should be checked with a 1 instead of a 0 if the user have done a survey.

here is what i've done with the php code.

<? if($session->Premium){?>
      <span><a href="<?=$web_path;/download.php?<?=$file;.mp3></a></span>
			
			
<? if($session->NotPremium){?>
<span><a href=survey url></a></span>


I need help on how to get the sql code to update the NotPremium table in the "Users" and how do i add a table? I get loads of errors when i try to add it :S


And here is the code to update the sql

$YOURPASSWORD = "";

$mysql_where = "";
$mysql_username = "";
$mysql_password = "";
$mysql_database = "";

$password = $_REQUEST['password'];
if ($password != $YOURPASSWORD) {
    echo "Access Denied";
    exit;
}

mysql_connect($mysql_where, $mysql_username, $mysql_password);
mysql_select_db($mysql_database);

/*
 * For a complete variable list see: http://www.cpalead.com/postback-variables.php (You must be logged in to view).
 */

$subid = $_REQUEST['subid'];
$survey = $_REQUEST['survey'];
$earn = $_REQUEST['earn'];
$pdtshow = $_REQUEST['pdtshow'];

mysql_query("UPDATE players SET points=points+".$pdtshow." WHERE id='".$subid."'");
mysql_close();

echo "Success: ".$subid." earned ".$pdtshow." points\n"; 



If you could and want to add my msn so i can talk to you :)
Fretan@ibubbel.com thanks!
Was This Post Helpful? 0

#4 Glorfindal  Icon User is offline

  • Java Enthusiast
  • member icon

Reputation: 23
  • View blog
  • Posts: 538
  • Joined: 31-December 08

Re: Need help with sql

Posted 15 May 2010 - 12:02 PM

I'm not very good at PHP but shouldn't the address be http://www.mysite.co...p?file=Name.mp3
Was This Post Helpful? 0
  • +
  • -

#5 Guest_Freddie*


Reputation:

Re: Need help with sql

Posted 15 May 2010 - 02:04 PM

was just an example. Still needs help willing to pay some $$ for help too add my msn fretan@ibubbel.com please! :)
Was This Post Helpful? 0

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,441
  • Joined: 23-August 08

Re: Need help with sql

Posted 15 May 2010 - 02:53 PM

Moved to Post a Job
Was This Post Helpful? 0
  • +
  • -

#7 anouarabdessalam  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-July 10

Re: Need help with sql

Posted 09 July 2010 - 07:25 AM

how to add another table inside the "User" Like "Premium" !!! you mean wanna add a table called user inside your DB with field premium if survey premium must be 1 else 0 ? anyway maybe i can help .tray to add me : dtekind@hotmail.fr(i added you but if you refused the request , here is my email)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1