Jump to content

Recommended Posts

I'm not a php programmer, in fact I am only here because I cannot for the life of me get this script to work, although it works just fine on a different server.

 

ok

file 1  holds :

 

connectdb();
$sid = $_GET["sid"];
$uid = getuid_sid($sid);

  echo "<p align=\"center\">";
    $sql = "select * from fun_users where val='0'";

    $result = mysql_query($sql);
    echo mysql_error();
    while ($item = mysql_fetch_array($result))
    {
      $lnk = "<a title=\"Enter\" href=\"xxxx.php?sid=$sid&user2=$item[1]\">$item[1]</a>";
      echo "$lnk <br/>";


}

This works just fine as far as I can see : clicking the link gives :

http://xxx.com/xxxx.php?sid=5f75cf73631769998acb3ff7047ac45e&user2=test

 

Now, entering xxx.php the code is:

 

<?php


include("core.php");
include("config.php");

connectdb();
............ headers all correct.......................

echo "<head>";

echo "<title>$stitle</title>";
echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/style.css\" />";
echo "</head>";

echo "<body>";

connectdb();
$sid = $_GET["sid"];
$uid = getuid_sid($sid);

  echo "<p align=\"center\">";
    $sql = "select * from fun_users where name='user2'";
    $items = mysql_query($sql);
    echo mysql_error();
    while ($item = mysql_fetch_array($items))
{
echo "<br/>";
echo "Name: ";
echo $item[1] ;
echo "<br/>D.O.B: ";
printf($item[3]);
echo "<br/>Sex: ";
printf($item[4]);
echo "<br/>Location: ";
printf($item[5]);
echo "<br/>Registered With: ";
printf($item[14]);
     $jdt = date("d m y-H:i:s",$item[17]);
echo "<br/>Registered Date: $jdt";
echo "<br/>Ip: $item[15]";

}

?>
<br/>
<img src="images/line.jpg" alt="----"/>
<br/>
<?php
echo "<a title=\"Enter\" href=\"zzzzz.php?sid=$sid&user2=$user2&action=1\">Validate Users</a>";
echo "<br/>";
echo "<a title=\"Enter\" href=\"zzzzz.php?sid=$sid&user2=$user2&action=3\">Dont Validate</a>";
echo "<br/>";
echo "<a title=\"Enter\" href=\"yyyyy.php?sid=$sid\">Back</a>";
echo "<br/>";
echo "<a title=\"Enter\" href=\"index.php?action=main&sid=$sid\">Main Menu</a>";

echo "</p>";
  



echo "</body>";
echo "</html>";
?> 

 

It appears to me that 'user2' is not being picked up, as the resulting web page does not print any of the data between the "while" and the html divider.

 

Can anyone help with this? Is there something fundamentally wrong or am I being even thicker than a newbie?

 

LOL

 

Thanks

 

Steve

Link to comment
https://forums.phpfreaks.com/topic/84730-solved-mysql-call-not-working/
Share on other sites

Ok, so far from your code, i've come up with these conclusions:

 

[#1] I have no idea what on earth $uid = getuid_sid($sid); does, is supposed to do, or for that matter, i cannot see it being used for anything, so get rid of it. Not to mention, unless i am unaware of some PHP built in function, getuid_sid doesn't exist.

 

[#2] It does not grab the value of user2 because you didn't include a get statement.

 

$user2 = $_GET["user2"];

 

[#3] You may want to clean up your excessive amount of echo's in your script and store it in a nice neat variable or something to call later.

 

$jdt = date("d m y-H:i:s",$item[17]);

$show = '<br/>Name: ' . $item[1] . '<br/>D.O.B: ' . $item[3] . '<br/>Sex: ' . $item[4] . '<br/>Location: ' . $item[5] . '<br/>Registered With: ' . $item[14] . '<br/>Registered Date: ' . $jdt . '<br/>Ip: ' . $item[15];

echo $show;

 

So change those couple of things and it should work.

 

Take care.

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.