Adri Posted April 23, 2006 Share Posted April 23, 2006 Hey,I have a site with a survey. After the first page, this is the script that I run:[code]include 'db_connect.php';$inleiding = mysql_query("SELECT * FROM inleiding") or die(mysql_error());$count_inleiding = mysql_num_rows($inleiding) or die(mysql_error());echo $count_inleiding;$id = $count_inleiding + 1;echo $id;$cookie_data = $id;if (setcookie("enquete", $cookie_data, $time+31536000)==TRUE) { if (isset($_COOKIE['enquete'])) { $cookie_info = explode("-", $_COOKIE['enquete']); $uid = $cookie_info[0]; if ((empty($_POST[v01a1])) && (empty($_POST[v01a2]))) ......[/code]It doesn't do anything. echo $count_inleiding doesn't give any resultand neither does echo $id;The table is empty.Anybody knows what I'm doing wrong? Link to comment https://forums.phpfreaks.com/topic/8195-code-doesnt-do-anything/ Share on other sites More sharing options...
massive Posted April 24, 2006 Share Posted April 24, 2006 [!--quoteo(post=367760:date=Apr 23 2006, 02:39 PM:name=Adri)--][div class=\'quotetop\']QUOTE(Adri @ Apr 23 2006, 02:39 PM) [snapback]367760[/snapback][/div][div class=\'quotemain\'][!--quotec--]Hey,I have a site with a survey. After the first page, this is the script that I run:[code]include 'db_connect.php';$inleiding = mysql_query("SELECT * FROM inleiding") or die(mysql_error());$count_inleiding = mysql_num_rows($inleiding) or die(mysql_error());echo $count_inleiding;$id = $count_inleiding + 1;echo $id;$cookie_data = $id;if (setcookie("enquete", $cookie_data, $time+31536000)==TRUE) { if (isset($_COOKIE['enquete'])) { $cookie_info = explode("-", $_COOKIE['enquete']); $uid = $cookie_info[0]; if ((empty($_POST[v01a1])) && (empty($_POST[v01a2]))) ......[/code]It doesn't do anything. echo $count_inleiding doesn't give any resultand neither does echo $id;The table is empty.Anybody knows what I'm doing wrong?[/quote]try this...[code]<?include 'db_connect.php';$query = "SELECT * FROM inleiding";$result = mysql_query($query) or die (mysql_error());?>----FORM--------------<form action = "<? echo $_SESSION['PHP_SELF']; ?>" method = "POST">=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=--=-=-=-in this part it will only display one result of a certain row =-=-=-=--=-=-=-=-=<?if(mysql_num_rows($result) > 0){ while($row = mysql_fetch_object($result)) { echo $row[0]; }} ?></form>[/code] Link to comment https://forums.phpfreaks.com/topic/8195-code-doesnt-do-anything/#findComment-29945 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.