I took a prnt scn of the error msg and my code here are the two links. If you need more information please let me know. error msg Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /hermes/bosweb26a/b1807/ipg.stmcevoy/Yourcss/index.php on line 10 error msg http://stmcevoy.ipage.com/work/error2.jpg index.php code http://stmcevoy.ipage.com/work/error1.jpg
First, get rid of mysql_ - it's a deprecated DB-handler, you should be using mysqli_ or PDO instead. Second, why are you pasting links to images of the code? Just put the code in CODE-tags and post it here, in the thread. Or use something like pastebin or jsfiddle or whatever, so we can edit the code, copy it etc.
as ajayr said, add mysql_error() at the line. $query = mysql_query(...) or die(mysql_error()); PHP: and let us know how does the error. so we can find the solutions.
Here is my pastebin of my code hopefully this will help out. http://pastebin.com/xqVwEVBb If you try and make a paste code on my website here http://www.yourcss.com/pastecode.php you will see the error i get.
I tried and replaced it with $query = mysql_query("SELECT * FROM code ORDER BY id DESC LIMIT 8"); PHP: but i got another error.
Try replacing mysql_fetch_array with mysql_fetch, and add a return for eventual mysql_errors - and, as stated earlier, stop using mysql_ - it's deprecated and horrid, and you should be using mysqli_ or PDO and proper, prepared queries
Listen to @PoPSiCLe about not using mysql_query but first lets get the basics of your sql organised. You're a newbie to all this, right? You have access to phpMyAdmin hopefully. If you run the query in phpMyAdmin what happens? You seemed to totally ignore the advice given about mysql_error(). If I have a query that I'm debugging, maybe I'm not sure if I'm building the sql right, or if the values are looking as I expect I'll have code that looks something like this (not that I send queries straight to the database anymore, thank you cakePHP and WP for handling all that for me) $where = array(); if ($rule1) $where[] = " `field1` = '{$val1}' "; if ($rule2) $where[] = " `field2` = '{$val2}' "; $sql = "SELECT `name`, `field3`, `field4` from table1 where status = '1' " .implode(' AND ', $where)." order by `name` limit 8"; $result = mysql_query($sql) or die('Error: '.mysql_error().'<br />'.$sql); PHP: that way I can see what my query looks like, I can see why the query failed. I can even copy my query into phpMyAdmin and test it there. If you get heavily into all of this I recommend getting a decent mysql gui - I like sqlyog but there are free versions around that are probably just as good.
please add the command or die(mysql_error()); Code (markup): and show us the error message. the or die is a php function. it's not an options.
Yes I am a noob to all of this so its a little confusing at first. Hopefully i am not ripping your guys hair off, just trying to get this site back and running properly. Now I added die (mysql_error()); like this <?php $query = mysql_query(...) or die(mysql_error()); while($r = mysql_fetch_array($query)) { $id = $r['id']; $user = format($r['user']); $posted = timeDiff($r['added']); echo '<p><a href="'.$id.'">'.$user.'</a><br /><span class="posted">'.$posted.'</span></p>'; } ?> PHP: Is this how you were trying to tell me to add or die(mysql_error()); if so i got a white screen shows up and this is written on it. Parse error: syntax error, unexpected '.', expecting ')' in /hermes/bosweb26a/b1807/ipg.stmcevoy/Yourcss/pastecode.php on line 7 Sorry if im making this more confusing then it has to be. I am a noob here trying to learn as i go.
use this. <?php $query = mysql_query("SELECT * FROM `code` ORDER BY `id` DESC LIMIT 8") or die(mysql_error()); while($r = mysql_fetch_array($query)) { $id = $r['id']; $user = format($r['user']); $posted = timeDiff($r['added']); echo '<p><a href="'.$id.'">'.$user.'</a><br /><span class="posted">'.$posted.'</span></p>'; } ?> PHP:
That tells you that the table "code" in the database "yourcss"(If im not mistaken...) does not exist.
Good gravy there's some terrifyingly bad code here... most of it reeking of pre-2006 and a significant portion having the air of "welcome to 1997" hanging about it. Those pictures tell the story of having learned how NOT to build a website; from the presence of CENTER and ALIGN, to the use of H4 when I REALLY doubt you have H2 or H3 preceeding them (given the layout screencap), paragraphs around obviously non-paragraph content -- and of course what you've been told several times to stop doing, the stupid malfing mysql_ functions despite our being told to stop using them since PHP 5 dropped (good for a laugh since 5.3 is now EoL) and their having added giant red warning boxes to the manual two or three years ago waving us off. I would suggest tossing this entire mess and taking the time to learn to use HTML and PHP properly before tackling anything like this; as I would be throwing it all away and starting over just to try and fix your bugs as there's little if anything there in terms of markup or back-end code I'd even try to salvage from this. Sorry if that sounds harsh, but the truth often is.
Well I didn't code, it I bought it and was trying to learn off of it but I guess I'm in another whole... Thanks for the help guys and I guess il just trash this and start over...