Jump to content

[SOLVED] Fairly simple script


DeathStar

Recommended Posts

Well i have been coding this script for a part game/mod but it wont work ?!?

 

I get the error :

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

But i cxant find anything wrong!

 

Can anyone help me?

 

the script

<?php
session_start();
//connect to the config file
include "config_o.php";
$userid=$_SESSION['userid'];
$date=date('Y');
//generate a random image
$ranimg = rand(1,5);
//end random

// Collects data from "users" table
$da = mysql_query("SELECT * FROM users WHERE userid=$userid")
    or die(mysql_error());

// puts the "users" info into the $info array
$ds = mysql_fetch_array($da );


// Collects data from "settings" table
$da1 = mysql_query("SELECT * FROM settings")
    or die(mysql_error());

// puts the "settings" info into the $info array
$ds1 = mysql_fetch_array($da );
// print the contents of the file
print "<table><td>";
//style
print "<b>Name:</b> {$ds['name']}
<br><b>Level:</b> {$ds['level']}
<br><b>Gold Cions:</b> {$ds['gcoins']}";

//if statements(race)
if ($ds['race'] == 1) {
    $srace = print "Human";
} else if ($ds['race'] == 2) {
    $srace = print "Dragon";
}

if ($ds['race'] == 3) {
    $srace = print "Elf";
} else if ($ds['race'] == 4) {
    $srace = print "Alien";
}

if ($ds['race'] ==5) {
    $srace = print "Paranormal";
}
//print race
print "<br><b>Race:</b> $race";
//end if

//if statments (subrace)
if ($ds['srace'] == 1) {
    $srace = print "Workers";
} else if ($ds['srace'] == 2) {
    $srace = print "Craftmens";
}

if ($ds['srace'] == 3) {
    $srace = print "Mages";
} else if ($ds['srace'] == 4) {
    $srace = print "Warriors";
}

if ($ds['srace'] ==5) {
    $srace = print "Archers";
}
//print srace
print "<br><b>Sub Race:</b> $srace";
//end if
print "<br><b>Place:</b> {$ds['place']} >> {ds['splace']}<br>
Click <a href='mainstats.php'>here</a> for main stats.
<br>Click <a href='substats.php'>here</a> for sub stats.";
print "</td><td>";
//get a random image
if ($ranimg == 1) {
    print "<img scr='{$ds1['banner1']}'>";
} else if ($ranimg == 2) {
    print "<img scr='{$ds1['banner2']}'>";
}

if ($ranimg == 3) {
    print "<img scr='{$ds1['banner3']}'>";
} else if ($ranimg == 4) {
    print "<img scr='{$ds1['banner4']}'>";
}

if ($ranimg == 5) {
    print "<img scr='{$ds1['banner5']}'>";
}
print "</td></table><br><BR>";
print "<center><i><center>Copyright © $date #####.</center></i>";
?>

Link to comment
https://forums.phpfreaks.com/topic/38934-solved-fairly-simple-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.