Jump to content

Archived

This topic is now archived and is closed to further replies.

Adri

code doesn't do anything

Recommended Posts

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 result
and neither does echo $id;
The table is empty.

Anybody knows what I'm doing wrong?

Share this post


Link to post
Share on other sites
[!--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 result
and 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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.