The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
[SOLVED] making this bit vbulletin friendly php mysql
Code:
$query = $db->query_first( "select * from redirect where(url = '$drc_url')"); if ($query == false){ $hits = "1"; $query2 = $db->query_write( "INSERT INTO redirect (url,hits) VALUES('$drc_url','$hits')"); } else { $hitquery = $db->query_first( "select hits from redirect where url = '$drc_url'"); $result = mysql_query($hitquery); $hits = mysql_result($result, 0, "hits"); $query2 = $db->query_write( "update redirect set hits = hits+1 where url = '$drc_url'"); } $db->query($query2); cant seem to get the else to function properly Code:
Call to undefined function mysql_query() mysql_ is depricated, and changing them to mysqli just breaks it worse =/ |
#2
|
|||
|
|||
Well if I check your piece of code then you don't need those 3 lines at all:
PHP Code:
query_first returns an array of the data from the first row by the way, so you can just use $hitquery['hits']. |
Благодарность от: | ||
Dr.CustUmz |
#3
|
|||
|
|||
Quote:
OR, you haven't opened a mysql connection to the database. Quote:
Code:
$result = mysql_query($hitquery); |
#4
|
||||
|
||||
PHP Code:
(got to run to the DMV to renew tags and lic almost my birthday, be back shortly) |
#5
|
|||
|
|||
That should work but this isn't needed, it doesn't do anything...
Code:
$hitquery['hits']; |
Благодарность от: | ||
Dr.CustUmz |
#6
|
|||
|
|||
Here's how I would do it:
PHP Code:
|
#7
|
||||
|
||||
ok now I want to relay those results back in an ordered manor
I have Code:
$query = $db->query_first( "select * from redirect order by hits desc"); $result = MYSQL_QUERY($query); $number = MYSQL_NUMROWS($result) or die (mysql_error()); $i = 0; if ($number == 0) { print "Nothing here"; } elseif ($number >= 1) { while ($i < $number){ $hits = mysql_result($result,$i,hits); $url = mysql_result($result,$i,url); if ($hits < 100){ $color = "$color100"; } print "<div align=\"left\">"; print "<table COLS=3 border=\"0\" width=\"100%\"><tr><td ALIGN=LEFT with=\"400\"><b><a href=\"$url\">$url</a></b></td>"; print "<td ALIGN=right WIDTH=\"60\"><b>$hits</b></td>"; print "<td align=left WIDTH=\"$hits\" BGCOLOR=\"$color\"> </td></tr>"; $i++; print "</table>\n"; } } |
#8
|
||||
|
||||
FYI the end result will be something like this:
everything is ready database wise, just want to create an overall stats page and put the count next to links. |
#9
|
||||
|
||||
this is the part i need help with =/
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|