Raised This Month: $51 Target: $400
 12% 

mysql / php thing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 08-14-2018 , 04:02   mysql / php thing
Reply With Quote #1

hello guys. im trying to make top15 somehow working...its saving by sql, and the there are three tables...one with map names, with player's informations and player's records...then im trying to show player ingame top15 by:

show_motd( id, "site.com/records/%s", mapname )

but can anyone help me about how to present records on every map differently, cuz im not that good at php and mysql

im thinking, should i have one .php which will generate in /records/ folder every map.php...like:

de_dus2.php
de_aztec_0.php
(and so on...every mapname from sql table)

or is there any 'easier' way?

thanks in advance!
JocAnis is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-14-2018 , 04:35   Re: mysql / php thing
Reply With Quote #2

Use GET parameters - site.com/records.php?map=%s.
__________________

Last edited by klippy; 08-14-2018 at 04:35.
klippy is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 08-14-2018 , 08:15   Re: mysql / php thing
Reply With Quote #3

as Klippy said use
PHP Code:
$_GET['map'
and
Code:
show_motd( id, "site.com/records.php?map=%s", mapname )
If you still need help just show .php code

Last edited by Airkish; 08-14-2018 at 08:16.
Airkish is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 08-14-2018 , 10:28   Re: mysql / php thing
Reply With Quote #4

ok how easy was it..thanks guys
now i got one strange problem...in chrome the top is LOADED properly...but in cs above the table it says:

mysql_fetch_array() expects parameter 1 to be mysqli_result boolean given in ...

and noone is in the table..weird

Edit: found where is the problem but not yet the solution:

$sql="SELECT ......... map=$map_name..."

*when i put map=de_dust (for example) it is working..

Last edited by JocAnis; 08-14-2018 at 10:57.
JocAnis is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-14-2018 , 12:38   Re: mysql / php thing
Reply With Quote #5

You didn't provide the code and the real (non-edited) error message, no one can help you.
__________________
klippy is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 08-14-2018 , 15:37   Re: mysql / php thing
Reply With Quote #6

mysql_fetch_array() expects parameter 1 to be mysqli_result boolean given in rekordi.php line 82

the thing is, with the present code for getting things from datebase:

Code:
$sql="SELECT ......... map=$map_name..."
the page perfectly loads data into table IN CHROME...but when i open the same url in steamcs it gives that error...i figured out what is the problem...weird but its like syntax thing...having '$' in $sql row is getting me this problem

Last edited by JocAnis; 08-14-2018 at 15:43.
JocAnis is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 08-14-2018 , 16:05   Re: mysql / php thing
Reply With Quote #7

Quote:
Originally Posted by JocAnis View Post
mysql_fetch_array() expects parameter 1 to be mysqli_result boolean given in rekordi.php line 82

the thing is, with the present code for getting things from datebase:

Code:
$sql="SELECT ......... map=$map_name..."
the page perfectly loads data into table IN CHROME...but when i open the same url in steamcs it gives that error...i figured out what is the problem...weird but its like syntax thing...having '$' in $sql row is getting me this problem
Try 'SELECT ......... map=".$map_name."'
Airkish is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 08-14-2018 , 16:25   Re: mysql / php thing
Reply With Quote #8

thanks for help.with your quotes it gives me insta error, but with added ' so its -> map='".$map_name."' its now showing in chrome, but table is empty in cs, without any error lol
JocAnis is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-14-2018 , 16:30   Re: mysql / php thing
Reply With Quote #9

PHP code doesn't depend on your browser, it's executed on the server, you have something else going wrong. Unless you post more than one string nobody can help you.
__________________

Last edited by klippy; 08-14-2018 at 16:30.
klippy is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 08-14-2018 , 16:58   Re: mysql / php thing
Reply With Quote #10

i think i understood what you said, but as i said, with that code, chrome is showing me everything with no problems, but in-game it wont show the same...what code should i post?

is this enough:

Code:
<?php
$con=mysqli_connect("localhost","root","","statistic");
$map_name = $_GET['map'];
$sql="SELECT name, time, date FROM rezultati JOIN players ON players .id=rezultati.id WHERE map=$map_name AND time ORDER BY time ASC LIMIT 15 ";
$records=mysqli_query($con,$sql);
?>
<html>
...style, table code...

<?php
while($st=mysqli_fetch_assoc($records))
{
$i=1;
echo "<tr align=center >";
echo "<td>".$i."</td>";
echo "<td>".$st['name']."</td>";
 echo "<td >".$st['time']."</td>";
  echo "<td>".substr($dr['date'], 0, -8)."</td>";
echo "</tr>";
$i=$i++;
}
?>
</table>
</head>
</body>
</html>
the site is like from above: blablabla.com/recs.php?map=dd2

Last edited by JocAnis; 08-14-2018 at 17:01.
JocAnis is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode