Alright so I am building an item database; I am having some issues with codes and I figure I could get some help from the users here. You all have proven useful before. Wish I had my old account password.
With my database I need to have my price checker to work with it as well. The code will have to be changed some to work in the database and I am not sure exactly what needs to be changed. If I can get some help it would be greatly appreciated.
What I need it to do is to get its id from my database. The field id is "Ge_id". So it needs to get Ge_id and post it in the url. I then need it to curl the information and get the three prices.
I next need to store the prices in the database in their fields. "Ge_Minimum, Ge_Market, and Ge_Maximum". I need a timestamp to work somehow to where it checks the price from the database. If it has been less than 12 hours it gets the price from the database. If it has been more than 12 hours it gets the price again and stores it. Then it updates the timestamp. How would I do this?
I believe this is all I need help on for now. Let me know if you need any of my scripts to work to get this working. Thanks in advance.
Now when I have been doing is: changing id to Ge_id and changing $_GET to $row.
I have an issue with this though. I am testing on PHP 5.3.0 ereg is depreciated. What would I use instead of ereg? I have tried a few things but the script just crashes.
Once I get the information I need to have it stored in the database. I know I will have to use the min, mark and max and make them into values for storage. How exactly would I do that and what would the storage script be?
That is what I was using. I get different errors when I switch to that. The server this will be on has a few versions older than the latest release. I am going to download that version of php and see if testing works with my code. If it does I will go ahead and finish building the database and then fix the code up when the server is moved to 5.3.0.
I have the script working now. I still need help on this part:
"I next need to store the prices in the database in their fields. "Ge_Minimum, Ge_Market, and Ge_Maximum". I need a timestamp to work somehow to where it checks the price from the database. If it has been less than 12 hours it gets the price from the database. If it has been more than 12 hours it gets the price again and stores it. Then it updates the timestamp. How would I do this?"
The timestamp updates on its' own when anything in the row is changed. I have that part done. I have the script that should be posting the info into the database but it isn't working out. Can I get someone to look over it please? Thanks.
PHP Code:
<?php
$con = mysql_connect('localhost','admin','password');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('itemdb', $con);
$result = mysql_query("SELECT * FROM items");
echo '<table>
<tr>
<th>Item</th>
<th>Members</th>
<th>Tradeable</th>
<th>Quest Only Item</th>
<th>Shop Selling Price</th>
<th>Low Alchemy</th>
<th>High Alchemy</th>
<th>Requirements to wield</th>
<th>Wield Slot</th>
<th>Requirements to make</th>
<th>Where to obtain</th>
<th>Examine Info</th>
<th>Other info</th>
<th>Picture</th>
<th>Price</th>
</tr>';
ereg has been deprecated. If you use it, in the future, your script will crash, and you or someone else will have to fix it. Use PHP: preg_match - Manual.
Dump out the strings produced by ereg, or better yet, preg_match.
Also - it looks like you need a space before "WHERE" - like so: " WHERE"