Error in MySQL Syntax error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

At this point here, it is not. It is coming from the images table.

Code: Select all

$result = mysql_query("SELECT * FROM images");
while ($row = mysql_fetch_array($result)) {
     $images[$row['name']] = $row['value'];
} 

$max_results = $row['maxshow']; 
// As of theline above $row is the result from the select on the images table
adamb10
Forum Commoner
Posts: 91
Joined: Sat Jun 24, 2006 7:44 pm

Post by adamb10 »

I updated the code to change max_results stored in settings. I forgot to change the variable. Even after changing the variable it still didnt work.

I think I need a new pagination script since it never worked anyways.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Try a different one. There are a few in the snippets forum I believe.
adamb10
Forum Commoner
Posts: 91
Joined: Sat Jun 24, 2006 7:44 pm

Post by adamb10 »

I'm redoing the entire database since I used columns before. :X
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

How much expeirence do you have with PHP and databases? Just wondering.
adamb10
Forum Commoner
Posts: 91
Joined: Sat Jun 24, 2006 7:44 pm

Post by adamb10 »

I thought I had a moderate amount but now I think I'm a n00b at it. I've used MySQL for around 1 1/2 years now.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Cool. It just seemed like you were getting crossed up a bit in that script you were using. It's all good. We are here to help. Keep plugging away at it and sooner or later you'll be a PHP Codemonkey like the rest of us.
adamb10
Forum Commoner
Posts: 91
Joined: Sat Jun 24, 2006 7:44 pm

Post by adamb10 »

The script is a guestbook and is actually one of the more advanced ones out there. I got Custom BBCode, World Filter, Baning, search(broken now), and soon smiley management.

Anyway I just found out that every query in the script has to be rewritten so now I'm kinda <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> off.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Well, good luck. Remember there are a lot of seasoned developers here that are willing to help you figure out your stresses and messes.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

World Filter
that should be great! Image
adamb10
Forum Commoner
Posts: 91
Joined: Sat Jun 24, 2006 7:44 pm

Post by adamb10 »

I need some help again creating a table in my database.

This table requires an id field. I set up 3 fields...

name
value
id

The id is a primary key with auto increment. I create 2 rows called ip and reason but this is where the problem resides...

Image

What do I do about it?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What are you trying to do with this table?
adamb10
Forum Commoner
Posts: 91
Joined: Sat Jun 24, 2006 7:44 pm

Post by adamb10 »

Its to hold ips and a reason. It's for banning visitors from the script.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

You are going to need a little more in your table. Maybe like this...

ban_id ( int(11), autoincrement, primary key)
ban_user_id (int)
ban_date
ban_release_date
ban_ip
ban_reason (varchar(255) or text)
adamb10
Forum Commoner
Posts: 91
Joined: Sat Jun 24, 2006 7:44 pm

Post by adamb10 »

Why do I need the additional info?
Post Reply