MarkT
-
Posts
168 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by MarkT
-
-
No records returned.Resource id #26is what it says, when I print the query ($pass)Then it's not returning a record. Print the query to see what you're telling the database to do. -
I've tried that, But i know there's a record, but it's still showing "No Records Returned"I suggest you look at the documentation on php.net for the functions you're trying to use. There are plenty of explanations and examples. You might also want to get some books, I would recommend oreilly.com as a publisher. If you don't understand what you're doing then looking at some code isn't going to change that, but here it is:$pass=mysql_query("SELECT password FROM users WHERE username='$user'");$pass2=mysql_fetch_assoc($pass);if ($pass2) { echo "Password:" . $pass2['password'] ;}else { echo 'No records returned.';}
-
Dont get it, Can you write the code I should have?$pass is a resource returned from mysql_query. $pass2 is an array representing the first row returned from the query, or false if it didn't return any rows. If the query returned at least one row then the array will have an element called password that contains the value from the database. -
Hello,I currently have the following code;$user=$_GET['user']; $pass=mysql_query("SELECT password FROM users WHERE username='$user'"); $pass2=mysql_fetch_assoc($pass); echo "Password:" . $pass ; but it's only saying; Password:Resource id #26
-
[PHP] Problem
in PHP
If the session ID is null then it sounds like you did not print out the query to verify it. That's why I said you should never assume anything, always verify.
What should I do now then?Maybe you need to verify the values of $name and $email? Are you extracting them from $_POST, maybe? Could that be a problem? -
I think you should use the CSS absolute positioning feature;tutorial here;http://www.w3schools.com/css/css_positioning.asp I suggest you put it inside a div where the image is and position it appropriately. You might be able to use display: overflow;
-
I just create a class, for example; #{DIV ID} .selected {background-color: #FF0000;} then in the HTML,<div id="{DIV ID}" class="selected"></div>
-
I'm not 100% sure, but it's only padding problems? I don't really see what the problem is, as I don't have a clue why it's doing what it is. It's extraordinary because I've never seen it in my 3 years of coding. Try uploading it to a free web host? And see if the styling changes again
-
Hello,I recently saw a lot of malicious spam flooding on the forums, was this a malicious attack? i'm just wondering why they did it, and how they got round the spam prevention features?
- 1
-
[PHP] Problem
in PHP
array(4) { ["id"]=> NULL Tried that and thats what I got ^^I think it's not saving the ID of the session in the below code;$id = mysql_query("SELECT * FROM `users` WHERE `name` = '{$name}' AND `email` = '{$email}'");$ida = mysql_fetch_assoc($id);$_SESSION['id'] = $ida['id2'];Try temporarily dumping more data. echo var_dump($_SESSION) . '<br>';$id= $_SESSION['id'];echo var_dump($id) . '<br>';$id2 = mysql_query("SELECT * from friends WHERE id1 = '{$id}'");echo var_dump($id2) . '<br>';$eid = mysql_fetch_assoc($id2);echo var_dump($eid); -
[PHP] Problem
in PHP
If you think of anything I could do! Let me know!!!!!No, there's no reason why a given query would return one set of results in one script and a different set in another script, that's not how databases work. It's going to return exactly what you tell it to return. If it's not returning anything, then there's nothing to return. If there was something to return then it wouldn't skip it. If you're telling me that you print the query that you're running in PHP, and you run that exact same query in phpMyAdmin, and it returns results there, then it's going to return the same results in PHP. Something's missing, but I don't know what it is. The code that you've shown looks fine to me. Maybe you're assuming incorrect things about what is in the session or something like that, but if you say that you used PHP to print out the query that you are actually running, and that query returns results in phpMyAdmin, then the query is not the problem. If you didn't actually print the query from PHP, but just assumed you knew what it was going to be, then that's not going to help you debug the problem. Don't assume that you know what anything is, always verify. -
[PHP] Problem
in PHP
Any more suggestions?I don't see anything in the code you posted that would stop the query or not print what it returned. -
create an image, and do <?PHP$captcha = $_POST['captcha']; if($captcha == {what image says}){ die('Invalid Captcha'); } etc. I'm sure you know how to finish the rest
- 1
-
Try this;padding-left: 10px; then post what happensim having trouble with indentation, as you can see in the picture,i already tried with margin, padding, , but still had a left indentationhere css code that had relation with the problem.container{width: 960px;background: #CCC;margin: 0 auto;overflow: hidden;} .sidebar1{float: left;width: 180px;background: #CCC;padding-bottom: 0;font-family: Verdana, Arial, Helvetica, sans-serif;}/*This is the "Archive: " word in stylin */ /*all below is belong to Home, About, and Sign-In anchor thats no relation on this problem */ ul.nav{list-style: none;margin-bottom: 15px;} ul.nav li{/* i didnt inserting this, nothing changed though*/} ul.nav a, ul.nav a:visited{padding: 7px 5px 7px 15px;display: block;width: 160px;text-decoration: none;background: rgb(41, 41, 41);;}
-
You want to make the header appear lower down the page?Do a margin-top: 10px;in the main header div that encloses everything in the headerMy host is godaddy, and i found it, however changing the height in the code below, doesn't do anything, not even after i published the website. Even if i delete the height entirely then publish it, nothing happens, any ideas? When i submitted a ticket, i was told they couldn't provide help with advanced coding? .sf_header_wrapper {background-image:url(http://i.imgur.com/0QBv29V.png);background-position:top;background-repeat:no-repeat;background-size: 100%;border:solid 10px #fff; height:377px } -
[PHP] Problem
in PHP
I have done this, and it shows the correct record in the database, but won't show it on the page.
-
[PHP] Problem
in PHP
$id= $_SESSION['id'];$id2 = mysql_query("SELECT * from friends WHERE id1 = '{$id}'");$eid = mysql_fetch_assoc($id2);if (!$id2) { die('Invalid query: ' . mysql_error());}echo "ID: " . $eid['id2'] ; is my current code;It's not displaying any errors, but it's also not displaying "2" because |I have a record where ID 1 = 1 (My session['id']) and ID2 = 2Look at the examples here, they call the error function if the query fails: http://www.php.net/m...mysql-query.php -
[PHP] Problem
in PHP
how do i do that>?Yeah, I don't either. MySQL obviously sees a problem with it though. You should ask MySQL what the problem is. -
[PHP] Problem
in PHP
$id= $_SESSION['id'];$id2 = mysql_query("SELECT * from Friends WHERE id1 = '$id'"); Is my query, but i dont see any problems with it?That means your query had an error, you need to check for errors from MySQL like Dad showed. If a query has an error then it will return boolean false instead of a resource, so that's why the error message says it was expecting a resource but got a boolean. After you run the query you need to check if it succeeded before you go on. -
[PHP] Problem
in PHP
On another page i have this code;You shouldn't need the '{ }' characters. They are generally used to disambiguate arrays. And add a semicolon to the end of line 2. Other than that, it looks OK. You should probably switch to the mysqli functions. The mysql functions are deprecated and will eventually disappear. You should also add some error handling. The example here shows ways to do that.$id= $_SESSION['id'];$id2 = mysql_query("SELECT * from Friends WHERE id1 = '{$id}'");$eid = mysql_fetch_assoc($id2);echo "ID: " . $eid['id2'] ;?>
But the echo isn't echo'ing what it should be, at the moment there is a entry where id1=1, which is the ID i'm logged in as which should be set in $_SESSION['id']and ID2 = 2, so it should echo 2, however it's not. It's saying;Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/u872116037/public_html/home.html on line 66 ID:
-
[PHP] Problem
in PHP
I have edited it to this, is it right?
$id = mysql_query("SELECT * FROM `users` WHERE `name` = '{$name}' AND `email` = '{$email}'"); $ida = mysql_fetch_assoc({$id})$_SESSION['id'] = $ida['id2'];
-
[PHP] Problem
in PHP
Can you please edit my code to show me?$id = mysql_query("SELECT * FROM `users` WHERE `name` = '{$name}' AND `email` = '{$email}'");$_SESSION['id'] = . $id["id"];
For starters, this won't work. As justsomeguy explained, $id is not an array. It's a resource. You pass it to mysql_fetch_assoc(), and the return value is an array. Same problem below:
$id2 = mysql_query("SELECT * from Friends WHERE id1 = '{$id}'");$eid = mysql_fetch_assoc("{$id2['id2']}");
Pass $id2 to mysql_fetch_assoc(). $eid will then be an array. I don't know the structure of your table, but it looks like the value you want will be returned in $eid['id2']
-
[PHP] Problem
in PHP
I now have;$id2 isn't a record from the database, it's the entire result set. You need to use another function to get a record from the result, like mysql_fetch_assoc if you're using the old mysql extension.$id = mysql_query("SELECT * FROM `users` WHERE `name` = '{$name}' AND `email` = '{$email}'");$_SESSION['id'] = . $id["id"];on the login page ^^^ On the page where i want to use the ID:$id= $_SESSION['id'];$id2 = mysql_query("SELECT * from Friends WHERE id1 = '{$id}'");$eid = mysql_fetch_assoc("{$id2['id2']}");echo "ID: " . $_SESSION['id'] ;
But it's not picking up $_SESSION['id']
-
[PHP] Problem
in PHP
Still not working,It should at the moment, echo "2", because thats the only record in the database,.Remove the quotes around Friends and id1, identifiers are not supposed to be quoted. You only quote a text value.
[PHP] Problem
in PHP
Posted
My $_SESSION['id'] returns null.These are where it sets the Session variable; $id = mysql_query("SELECT * FROM `users` WHERE `name` = '{$name}' AND `email` = '{$email}'");$ida = mysql_fetch_assoc($id); $_SESSION['id'] = $ida['id2'];