Jump to content

Can Some One Spot The Error ?


hopbop

Recommended Posts

ok so simpole loop i know the connetion works in the config file because it's in other files working and the mysql_select_db is working and corect but for the life of me can not get this thing to display the information! help this is driving me up the wall

 

<?php
 $date1=$_GET['date1'];
 $date2=$_GET['date2'];
 $ecs=$_GET['ecs'];
include '../config.php';
mysql_select_db("_learn_sym");
$result = mysql_query("SELECT * FROM clients WHERE date <= '$date1' and date >= '$date2' and ecs= '$ecs'") or die(mysql_error());
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
 printf("ID: %s Name: %s", $row[0], $row[1]);
}
mysql_free_result($result);
?>

Edited by hopbop
Link to comment
Share on other sites

How do you even know the query is returning any results? You aren't checking for an empty results set, you're just displaying it regardless of whether there's anything there or not. Have you echoed the query to make sure it contains the values you'd expect it to contain, then tried executing it in phpMyAdmin to see what happens?

Link to comment
Share on other sites

How do you even know the query is returning any results? You aren't checking for an empty results set, you're just displaying it regardless of whether there's anything there or not. Have you echoed the query to make sure it contains the values you'd expect it to contain, then tried executing it in phpMyAdmin to see what happens?

 

yes i have done that and it is returing results ......

Link to comment
Share on other sites

Post the code you used when you echoed the actual query string, along with the output it generated.

 

<?php
 $date1=$_GET['date1'];
 $date2=$_GET['date2'];
 $ecs=$_GET['ecs'];
include '../config.php';
mysql_select_db("_learn_sym");
$result = mysql_query("SELECT id FROM clients WHERE ecs= '$ecs'") or die(mysql_error());
$row = mysql_fetch_array($result);

echo $row['id'];


?>

 

output : 05634

Edited by hopbop
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.