echoindia756
-
Posts
21 -
Joined
-
Last visited
Never
Posts posted by echoindia756
-
-
Anyone any ideas?
-
Hi thanks for that!
I think I almost got it working, the problem I am having now is that if there is more than one row in the table, it only displays one of the rows on the html table, is there anyway to display all of the rows that are in the table?
Many thanks for your help.
-
anyone any ideas?
-
Hi there,
I'm having a bit of trouble getting something to work. Basically, I have several fields in a table:
"Item Name" and "Item Price"
These values are dynamic to each user (so different items will appear depending on your username),
I want to retrieve this information from the database row and put it into a HTML table on the users homepage on my website
So for example the data would appear like this:
Item Name Item Price
Digital Camera €40.00
Underwater Camera €50.00
So I think the mysql query would be something like:
mysql_query("SELECT * FROM table_name WHERE user_id = $_SESSION['user_id']");
But i'm not sure how to get all the users items to display on the table, could someone help me with the PHP code please?
I'd really appreciate it!
Thanks in advance!
-
Please! Can anyone help me out?
-
Hi guys,
Does anybody have any ideas? How about if I tried something with
$_SESSION
? Would that work?
For example, could I put
WHERE game_planets.id_owner = $_SESSION['userid']
?
-
-
You know how you said:
it would be WHERE `id_owner`='[however you have your data set]'in the "however you have your data set", what exactly goes there? Another table? e.g
`game_planets.id_owner`='game_planets.name' LIMIT 1");
This is puzzling me!
-
Ok, so when you say "=" does that mean that for example 1=1 or does it mean that they are in the same row of data? I'm just slightly confused! Thanks!
-
mysql_query("UPDATE `game_planets` SET `belcredits`=`belcredits`+100 WHERE `username`='username' LIMIT 1");
There is an example of how it would update only one record based on username being usersname
though I highly suggest using an ID field and ID being a UNIQUE.
Thanks! I have an ID Field in the database called id_owner and another field with the name of the planet. So would this work?
mysql_query("UPDATE `game_planets` SET `belcredits`=`belcredits`+100 WHERE `name`='id_owner' LIMIT 1");
-
Yea, that would be the logical thing - but how do I get the user id, I mean, I know you use the SELECT command to get things but how do I tell the code to identify the current user and match it up with the data in the username's field? If I could do that, that would solve the problem!
-
You know what I mean anyway.
-
Ok, for example: Let's say one of the errors is
$SelectProduct = $_GET['whatever'];
You would put that near the top of the page, and then wherever the error is, you just right it so that it says:
$SelectProduct;
i.e remove everything after the equals, except the semi-colon of course.
-
Is there no way I can tell the code to only update the person's belcredits who bought the credits?
-
Got this:
/includes/header.php on line 48
Notice: Undefined index: css in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 125
Notice: Undefined index: HTTPS in /home/vol1/byethost13.com/b13_1141145/errion.byethost13.com/htdocs/includes/header.php on line 9
You'll have to make those lines so their not relying on register_globals being on.
-
mysql_query("UPDATE `game_planets` SET `belcredits=belcredits+100");
That doesn't have any where clause?? lol
-
Try typing in this right after the first "<?php"
ini_set ("display_errors", "1");
error_reporting(E_ALL);
That should display any errors there are.
-
your update query will update all the records in your belcredits because you dont have any condition "where clause" that says what record to be updated
I tried a few Where Clause's, but what clause would I write so that it only updated the users credits that actually bought the credits?
-
Do you write this code by hand? I'd suggest using Dreamweaver CS3 as it makes developing dynamic websites a piece of cake!
-
Hi there,
I'm designing an online game website. I'm having a little trouble getting something to work right. You see players of the game can buy "credits", these allow them to buy things to further their rank etc and make them stronger than other players. But the problem i'm having is that when a player buys credits, it gives that player credits, but it also gives every other player in the database credits! So if one person buys 100 credits, every user in the database gets 100 credits.
This is the code i'm using:
mysql_query("UPDATE `game_planets` SET `belcredits`=`belcredits`+'100'");
How would I change that code so it only updates the person's credits who actually bought them? I was thinking of something like getting the username that the user used to login, or maybe somebody can think of a better way to solve this. Thanks in advance!
Getting Data from MySQL Row in the database, and displaying on web page
in PHP Coding Help
Posted
anyone got any suggestions please!?