Jump to content

Janj

Members
  • Posts

    25
  • Joined

  • Last visited

Janj's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. Turns out I was requesting the wrong page.I forgot to make sure that on the first time, it checked to see if status wasn't "done," fixed it. Changed line 40 to if($_GET['id']=="" && $_GET['status']=="") and line 95 to else if ($_GET['id']=="" && $_GET['status']=="done") And I turned the $result line "back on." My error is: No database selected in /hermes/waloraweb018/b1141/as.jansaviation/acp/changearticle.php on line 126. Which I only get from the result line. At the top, I already put mysql_select_db("newsdb", $con); so I don't know why it's telling me 'no database selected.' I tried this suggestion of prefixing the table with the database (changing UPDATE articles to UPDATE newsdb.articles) Well, that just worked. Thanks so much!
  2. Off, turned it on. Now I see this: Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /hermes/waloraweb018/b1141/as.jansaviation/acp/changearticle.php on line 42 Fatal error: Query Failed! SQL: UPDATE articles SET [here goes a looot of stuff, what was typed in] WHERE artnum='1' - Error: No database selected in /hermes/waloraweb018/b1141/as.jansaviation/acp/changearticle.php on line 127 $sql = "UPDATE articles SET art_title='".$art_title."', art_image='".$art_image."', image_caption='".$image_caption."', image_src='".$image_src."', image_src_location='".$image_src_location."', article ='".$article."' WHERE artnum='".$_POST['ID']."'"; $result=mysql_query($sql) or trigger_error("Query Failed! SQL: $sql - Error: ".mysql_error(), E_USER_ERROR); //mysql_query($sql); echo "Article edited."; If I comment out the $result line but uncomment the mysql_query line I get this: Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in /hermes/waloraweb018/b1141/as.jansaviation/acp/changearticle.php on line 42 Article edited. Here's my document: http://pastebin.com/Uk04mgui
  3. Back on a computer. Changed it back to mysql, still the same. I also changed error reporting from E_ALL & ~E_NOTICE to E_ALL. Nothing yet. The bottom of the source shows this: <div class="big">CHANGE ARTICLE</div> <!--Do not insert anything before this line--> Right after which comes the code, then comes the closing div, body, and html, all of which are not displayed. So when $result=mysql_query($sql) or trigger_error("Query Failed! SQL: $sql - Error: ".mysql_error(), E_USER_ERROR); appears, it prevents anything past it from loading.
  4. Here it is, my attempt: $sql = "UPDATE articles SET art_title='".$art_title."', art_image='".$art_image."', image_caption='".$image_caption."', image_src='".$image_src."', image_src_location='".$image_src_location."', article ='".$article."' WHERE artnum=".$_POST['ID'].""; $result=mysqli_query($sql) or trigger_error("Query Failed! SQL: $sql - Error: ".mysqli_error(), E_USER_ERROR); //mysql_query("UPDATE articles SET art_title='".$art_title."', art_image='".$art_image."', image_caption='".$image_caption."', image_src='".$image_src."', image_src_location='".$image_src_location."', article ='".$article."' WHERE artnum=".$_POST['ID'].""); echo "Article edited."; But the page just doesn't load it. Not even "Article edited"
  5. Well I knew the query failed because nothing happened, but I don't know how to check it... Looked for an article on update syntax. Found one from MySQL and a million questions about it. I changed all the \"s to 's, put the WHERE after the SET, and removed the quotes around $_POST['ID'] I'm on my iPad right now so testing isn't as easy as it is on the computer so I'll wait for tomorrow to continue this.
  6. I created a script that is supposed to update some values in a database. However, it won't change anything. This is my code: //Edit article mysql_query("UPDATE articles WHERE artnum=\"".$_POST['ID']."\" SET art_title=\"".$art_title."\", art_image=\"".$art_image."\", image_caption=\"".$image_caption."\", image_src=\"".$image_src."\", image_src_location=\"".$image_src_location."\", article =\"".$article."\""); echo "Article edited."; I know that it is executed because it is in an if statement and I can see the "Article edited." But I've tried altering the actual query various times, changing the order of the WHERE and SET, etc, using mysqli_query, and nothing has worked so far.I've checked all my variables, they all exist and I can echo each one of them. I have no idea what to do.
  7. It seems AdBlock was blocking it. Thanks!
  8. There's something wrong on my site... I'm implementing ads, so I'm testing it out. I created an image saying that 'you can advertise now' or something like that. However, the image is in my /img/ads/ folder. I've tried changing the name of the image, but it still won't display. Here's the code: <a href="http://[redacted]/advertising.php"><img src="img/ads/jansav_ad.png"></a> I tried fixing the code. I put it in the TryIt Editor and the image still wouldn't display.I thought it would be something wrong with the image, but strangely, I can still see it on my iPad and iPod. Here's the picture: [redacted] Or since it likely doesn't show up, it's here: [redacted] I never knew something like this can happen. I uploaded the image a few days ago, and thought it might take a while (sometimes it takes a few hours until I can see it) it's been too long.
  9. Solved — went into the php.ini and changed the session save location.
  10. Yeah, it's not passing the variables on. I altered check.php: if(!isset($_SESSION['loggedin'])) { echo "error "; echo session_id(); exit; } When I go to newarticle.php, I get an error (because apparently loggedin isn't set) but I do get the session id. It's strange, I would'nt expect to get one and not the other. Are they (the variables) not being saved?
  11. Hey. Sorry I haven't been on in a while, I was really sick and I couldn't get to this. Just phpinfo'd it. I get no value for output_buffering and On for register_globals. Turned off register_globals. I think the issue is that it's not reading the $_SESSION variables. I have them in my browser, and every page begins with session_start(); but it's not finding them.
  12. Well, even though I just tried it now, since newarticle.php already has it that probably wouldn't make a difference.
  13. One of the stupidest mistakes I have ever done For some reason, it still doesn't work! Updated the code: <?php session_start(); if($_GET['status']=="done") { if($_POST['username']=="username" && $_POST['password']=="password") { $_SESSION['loggedin']='true'; $_SESSION['name']="test"; } } ?> I then go to login.php, type in the username/password, and I recieve the usual confirmation: LOGGED IN AS test. But then when I navigate to newarticle.php I get redirected back. Hmm...
  14. Hi, I have an issue where my session variables are not saved. Here's my pages are supposed to do check.php, included in all pages contains this: <?php if(!isset($_SESSION['loggedin'])) { header("Location: login.php"); } ?> Which means that if the session variable is not set, it redirects to login.php. login.php contains a username and password box. This is the code: if($_GET['status']=="done") { if($username=="username" && $password=="password") { $_SESSION['loggedin']='true'; $_SESSION['name']="test"; } } ?> (header stuff) <?php if($_GET['status']!="done") { echo" <form action=\"login.php?status=done\" method=\"post\"> Username: <input name=\"username\" type=\"text\" /><br /> Password: <input name=\"password\" type=\"password\" /><br /> <input name=\"login\" type=\"submit\" id=\"login\" value=\"Log In\" /> </form>"; } else if($_GET['status']=="done") { if($_SESSION['loggedin']==true) { echo "LOGGED IN AS ".$_SESSION['name']; } else { echo "INVALID USERNAME OR PASSWORD / TRY AGAIN"; } } ?> Of course, it echoes "LOGGED IN AS test" But when I visit newarticle.php, I get redirected back to login.php. Herés newarticle.php's code (just the top, there's more): <?php session_start(); include ("check.php"); ?> I'm not sure what I'm doing wrong. I've tried putting session_start(); in check.php, but that didn't work either. I'm not sure it's even my fault...
  15. I found out that putting the HTML code for the character (such as ) works without messing up. Thanks for your help, I learned something!
×
×
  • 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.