Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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