Follow us on Twitter!
Don't judge the unknown - Grindordie
Wednesday, April 23, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 20
Guests Online: 20
Members Online: 0

Registered Members: 82876
Newest Member: bhl1986
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

Mysql Row data php


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 09-08-07 19:22
Heya guys, Im trying to make a points system for my site ..
All i need now .. is to echo them :P Sounds simple yea .. But i cant seem to get the sql bit right ..
Ive tried loooads of different things .... But this is my most recent attempt
Code

<?php
function dbarray($query) {
   $result = @mysql_fetch_assoc($query);
   if (!$result) {
      echo mysql_error();
      return false;
   } else {
      return $result;
   }
}
function dbrows($query) {
   $result = @mysql_num_rows($query);
   return $result;
}
$un = $_SESSION['session_user'];
mysql_connect("localhost", "root", "***********") or die(mysql_error());
mysql_select_db("cms") or die(mysql_error());
$query = "SELECT * FROM users WHERE username=$un";
$result = mysql_query($query);
if (dbrows($result)) { $data = dbarray($result); }
$req_points = $data->points;
echo "req_points";
?>







Edited by on 09-08-07 19:41
Author

RE: Mysql Row data php


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 09-08-07 19:32
Can you remove smilies and post an output,

You are also missing an $ on the final echo


Author

RE: Mysql Row data php


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 09-08-07 19:42
smilies removed in above post ^ ....
And yea i changed that but still ahve my prob ...
The last bit was an ad-lib for example anyway .. but carry on ..


Author

RE: Mysql Row data php


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 11-08-07 00:11
replace
Code

if (dbrows($result)) { $data = dbarray($result); }
$req_points = $data->points;
echo "req_points";
?>




if
Code

$data = mysql_fetch_object($result);
$req_points = $data->points;
echo "$req_points";
?>