Jump to content

danx30

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

danx30's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. No errors showing up. It's just not adding the info to the database.
  2. The name of the user pulled from the URL, and a table created using that name.
  3. mysql_query("INSERT INTO '.$name.' (amount) VALUES ('$amount')"); Can't seem to figure out what I'm doing wrong with that line. It doesn't insert anything into the database. Any help would be appreciated.
  4. Thanks, I figured out how to do it. You helped me get unstuck.
  5. What I'm trying to do is have a section of my website to list the last 10 users of the page. The users are saved into a mysql database. There are thousands of users but only want it to show the last 10. For some reason this is stumping me. I'm just not sure how to approach it. Any help would be appreciated.
  6. Yep, that's my issue. If I use a number as the field name it doesn't work. What would the syntax be to add a letter in front of the number, so instead of 12 it would be like a12?
  7. Well that is my whole problem then I think...
  8. Apprently I am not making myself very clear. Lets try this again.. Someone hits the page and parses a 12 to the $id variable. Which in my database there is a column named 12.. I need it to insert a 1 into that field. But not everyone will parse a 12, some may parse another number which will have columns already setup for in the database.
  9. There are about 20 columns, all with different names. When the user hits the php page it will parse a specific column name which is the variable $id. So I need it to insert a 1 into that column if it's used. But because there could be any of 20 different ones I have to use a variable. So I need the field name to be a variable.
  10. the $id is a variable that changes depending on who access the page, so it can't be a specific field name. It needs to be a variable.
  11. Here is the code. $query4 = "UPDATE users SET $id='1' WHERE name='".$n1."'"; if I change the $id to a specific field it works fine. But I need it to be a variable. Any ideas?
  12. Solved it, found a missing $ and that fixed everything. Thanks for all the help.
  13. I tried to combine what you posted with my script and I get nothing but a blank page. I'm sure it's something simple I'm not seeing. <table border="0" width="100%"> <tr> <td width="6%" bgcolor="#00FFFF"><p align="center"><small><font face="Verdana">Rank</font></small></td> <td width="7%" bgcolor="#00FFFF"><p align="center"><small><font face="Verdana">Name</font></small></td> <td width="11%" bgcolor="#00FFFF"><p align="center"><small><font face="Verdana">Amount Owed</font></small></td> <td width="76%" bgcolor="#00FFFF"><p align="left"><small><font face="Verdana">IP Number</font></small> </td> <?php $page = $_GET["page"]; $var = @$_GET['q'] ; $trimmed = trim($var); $row_max = 20; //or how many results you want per page if(!isset($page)) { $page = 1; } if($page == 1) { $pagein = 0; $pageout = $row_max; } if($page > 1) { $pagein = $page * $row_max - $row_max; $pageout = $pagein * $row_max; } mysql_connect("localhost","username","password"); mysql_select_db("db") or die("Unable to select database"); $query = "select * FROM users WHERE name LIKE \"%$trimmed%\" order by name ASC"; $result = mysql_query($query); $num = mysql_num_rows($result); $query2 = "SELECT * FROM users WHERE name LIKE \"%trimmed%\" LIMIT $pagein, $pageout"; $result2 = mysql_query($query2); $rank = 1; while ($row = mysql_fetch_array($result2)) { print("</tr><tr>"); if($color == "#D8DBFE") { $color = "#A6ACFD"; } else { $color = "#D8DBFE"; } print("<td width=\"6%\" bgcolor=\"$color\"><center><small>"); print("<font face=\"Verdana\">$rank</font></small></center></td>"); print("<td width=\"7%\" bgcolor=\"$color\"><center><small>"); print("<font face=\"Verdana\"><strong>$row[0]</strong></font></small></center></td>"); print("<td width=\"11%\" bgcolor=\"$color\">$row[2]<center><small>"); print("<td width=\"76%\" bgcolor=\"$color\"><left><small>"); print("<font face=\"Verdana\">$row[15]</font></small></left></td>"); $rank++; } } $pagecount = ceil($num / $row_max); echo "Page "; $x = 1; $y = $pagecount; for( $i = $x; $i <= $y; $i++ ) { print "<a href='newsearch.php?page=$i'><b>[$i]</b></a> "; } ?>
  14. I did read that. It didn't help me.
×
×
  • 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.