Jump to content


Photo

code doesn't do anything


  • Please log in to reply
1 reply to this topic

#1 Adri

Adri
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 23 April 2006 - 07:39 PM

Hey,
I have a site with a survey. After the first page, this is the script that I run:

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]))) 
...
...

It doesn't do anything.
echo $count_inleiding doesn't give any result
and neither does echo $id;
The table is empty.

Anybody knows what I'm doing wrong?

#2 massive

massive
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 24 April 2006 - 12:34 AM

[!--quoteo(post=367760:date=Apr 23 2006, 02:39 PM:name=Adri)--][div class=\'quotetop\']QUOTE(Adri @ Apr 23 2006, 02:39 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Hey,
I have a site with a survey. After the first page, this is the script that I run:

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]))) 
...
...

It doesn't do anything.
echo $count_inleiding doesn't give any result
and neither does echo $id;
The table is empty.

Anybody knows what I'm doing wrong?
[/quote]





try this...


<?

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>






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users