$wpdb not working for me.
-
Simple question but no one seems to find an answer to it.. why.. idk..
This following question is based off of “$wpdb”
How to take $current_user->logged_in
and check if it is in the database under “guestbook (table)” and “names (column)…Here’s my code…
$query = "SELECT * FROM myguestbook"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes // print them one after another echo "<table cellpadding=10 border=1>"; while($row = mysql_fetch_row($result)) { echo "<tr>"; echo "<td>"."<center>".$row[0]."</center>"."</td>"; echo "<td>" . $row."</td>"; echo "<td>".$row."</td>"; echo "</tr>"; } } else { // none // print status message echo "No rows found!"; }
So.. Im able to get the data.. but here’s where im stuck… I want to take the data from the database and put it in a IF statement.
Example
<?php if ($row(0) = $current_user->logged_in) {//do something...} ?>
I can’t seem to have it check the whole Table.. it only checks to see if the first entry is the name.. Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘$wpdb not working for me.’ is closed to new replies.