Help - Search - Members - Calendar
Full Version: [resolved] messed up again.
Codegrrl.com Forums > Script Help > Tutorial Help
Ami
here is the URL for the edit entry

http://www.everybreeze.net/editentry.php

and

http://www.everybreeze.net/update.php

please help again.

Ami smile.gif
uttershambles
QUOTE(Ami @ Mar 22 2008, 12:22 PM) *
here is the URL for the edit entry

http://www.everybreeze.net/editentry.php

and

http://www.everybreeze.net/update.php

please help again.

Ami smile.gif


QUOTE

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/jeverybr/public_html/editentry.php on line 8


There's something wrong in your MySQL query. Do you think you could possibly post the code?
Amelie
Also, update.php won't work without an ID. You need to go to update.php?id=1 (or whatever ID the post is you want to edit), not update.php.
Ami
QUOTE(Amelie @ Mar 22 2008, 05:03 PM) *

Also, update.php won't work without an ID. You need to go to update.php?id=1 (or whatever ID the post is you want to edit), not update.php.


Here is the code. Also, how do I tell what the id is? I tried both update.php?id=1 as well as 01 but neither work.

<?php

mysql_connect ('localhost', 'jeverybr_ami', '*******') ;
mysql_select_db ('jeverybr_blog');

$result = mysql_query("SELECT timestamp, id, title FROM blogtable ORDER BY id DESC");

while($row = mysql_fetch_array($result)); {
$date = date("l F d Y",$row['timestamp']);
$id = $row['id'];
$title = strip_tags(stripslashes($row['title']));

if (mb_strlen($title) >= 20) {
$title = substr($title, 0, 20);
$title = $title . "...";
}
print("<a href=\"update.php?id=" . $id . "\">" . $date . " -- " . $title . "</a><br />");
}

mysql_close();

?>
uttershambles
Just fyi, you might want to change your mysql password.

Also where it has this:
CODE

while($row = mysql_fetch_array($result)); {


there should be no semicolon

CODE

while($row = mysql_fetch_array($result)) {


Amelie
You don't need to remember the IDs, when the editentries.php page is working, it will add the IDs for you.
Ami
QUOTE(uttershambles @ Mar 22 2008, 11:28 PM) *

Just fyi, you might want to change your mysql password.

Also where it has this:
CODE

while($row = mysql_fetch_array($result)); {


there should be no semicolon

CODE

while($row = mysql_fetch_array($result)) {




I removed the semi-colon now this is the error message I get:


Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/jeverybr/public_html/editentry.php on line 8

here is the code again.

<?php

mysql_connect ('localhost', 'jeverybr_ami', '***********') ;
mysql_select_db ('jeverybr_blog');

$result = mysql_query("SELECT timestamp, id, title FROM blogtable ORDER BY id DESC");

while($row = mysql_fetch_array($result)) {
$date = date("l F d Y",$row['timestamp']);
$id = $row['id'];
$title = strip_tags(stripslashes($row['title']));

if (mb_strlen($title) >= 20) {
$title = substr($title, 0, 20);
$title = $title . "...";
}
print("<a href=\"update.php?id=" . $id . "\">" . $date . " -- " . $title . "</a><br />");
}

mysql_close();

?>
Amelie
Change this line:

CODE
$result = mysql_query("SELECT timestamp, id, title FROM blogtable ORDER BY id DESC");


To this:

CODE
$result = mysql_query("SELECT timestamp, id, title FROM blogtable ORDER BY id DESC") or die('Could not get entries: ' . mysql_error());


Paste what it says here when you go to the page - it won't fix the problem, but it will tell us what's causing it.
Ami
QUOTE(Amelie @ Mar 23 2008, 11:03 AM) *

Change this line:

CODE
$result = mysql_query("SELECT timestamp, id, title FROM blogtable ORDER BY id DESC");


To this:

CODE
$result = mysql_query("SELECT timestamp, id, title FROM blogtable ORDER BY id DESC") or die('Could not get entries: ' . mysql_error());


Paste what it says here when you go to the page - it won't fix the problem, but it will tell us what's causing it.



This is what it says, problem is, blogtable does exist

"Could not get entries: Table 'jeverybr_blog.blogtable' doesn't exist"
uttershambles
QUOTE(Ami @ Mar 24 2008, 02:14 PM) *

This is what it says, problem is, blogtable does exist

"Could not get entries: Table 'jeverybr_blog.blogtable' doesn't exist"


You made sure you ran the create.php first right? And also that's what you called your blog table?
Ami
QUOTE(uttershambles @ Mar 24 2008, 03:37 PM) *

QUOTE(Ami @ Mar 24 2008, 02:14 PM) *

This is what it says, problem is, blogtable does exist

"Could not get entries: Table 'jeverybr_blog.blogtable' doesn't exist"


You made sure you ran the create.php first right? And also that's what you called your blog table?



create.php??? I ran it as the tutorial told me which was upload it and browse to it. It gave me a success message and I went to the next tutorial from there. Was there a seperate create.php I was suppose to run??? and yes, that is what I called my blog table.

A:)
Amelie
There is no create.php - I think uttershambles is a bit confused. tongue.gif

You're supposed to change blogtable to what your blog table is actually called, e.g. php_blog.
uttershambles
QUOTE(Amelie @ Mar 25 2008, 12:45 AM) *
There is no create.php - I think uttershambles is a bit confused. tongue.gif

You're supposed to change blogtable to what your blog table is actually called, e.g. php_blog.


I meant whatever the file was called to create the tables - sorry cry.gif
Ami
QUOTE(uttershambles @ Mar 25 2008, 07:45 AM) *

QUOTE(Amelie @ Mar 25 2008, 12:45 AM) *
There is no create.php - I think uttershambles is a bit confused. tongue.gif

You're supposed to change blogtable to what your blog table is actually called, e.g. php_blog.


I meant whatever the file was called to create the tables - sorry cry.gif


yes I did that thanks, so what now?
Jamie
What is your blog table called? What did you name it when you ran the script to create the tables?
Ami
QUOTE(Jamie @ Mar 25 2008, 06:44 PM) *

What is your blog table called? What did you name it when you ran the script to create the tables?


blogtable.php

Amelie
No, what did you name the part in the file? When you did part 1 of the tutorial, it instructs you to make your tables, what did you write where the tutorial currently says 'php_blog'? If you didn't change it, then put php_blog in your code instead of blogtable.
Ami
YAY!! It worked. Thanks everyone for your help. I'm sure you'll be hearing from me again. A:)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.