-
Posts
876 -
Joined
-
Last visited
-
Days Won
4
Everything posted by PaulRyan
-
<?php $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json')); curl_setopt($c, CURLOPT_URL, 'http://data.mtgox.com/api/2/BTCUSD/money/ticker'); $content = curl_exec($c); curl_close($c); $api = json_decode($content, TRUE); return print_r($api['data']['avg'], TRUE); ?>
-
<?PHP $x = isset($_POST['x']) ? trim($_POST['x']) : FALSE; ?>
-
You don't need the end tags, in fact it is considered bad practice to have them when including files. It prevents the dread header already sent error that happens when you leave space after the closing tag. It is best to emit them.
-
In the "usersmysql.php" do you have the opening PHP tags? Like so: <?PHP $host="127.0.0.1"; $username="globaluser"; $password="d4TXz4ATHgcvqJx"; $db_name="project1"; $tbl_name="useraccounts";
-
You missed the closing quote on this line. $username="globaluser;
-
That error doesn't reference those lines, it's most likely somewhere else in the function. Post all of the code.
-
try either in_array OR array_key_exists
-
You should have explained your question a bit better, but we got their in the end. You need to create a log in form, then check their log in details against the database. I assumed you had them logged in, but couldn't get the data you wanted back.
-
The code you want to have on your page should definitely go above the header.php include part. This is to keep all processing above any output to the browser. Place this code above the header include, but below init.php include. echo '<pre>'; print_r($_POST); echo '</pre>'; Then check the output of that before and after form submission.
-
Nope, that should do. Am I right in saying your problem is that when you submit the form, nothing is showing up? I.E. the text in the conditional statement? P.S. Could you post the content on init.php and header.php?
-
I didn't quite understand this "i have my errors showing all right now" Do you have error reporting turned on? This may uncover an error from one of the included files.
-
Can anyone help with this save to mySQL database problem?
PaulRyan replied to jordan443's topic in PHP Coding Help
Are you sure? I can spot quite a few things that will output some errors for you to see. If the error reporting really did nothing, then you need to next debug your code, to see what is going wrong and where. I would display all the $_POST data on form submission, to make sure it is what you expect. Then I would debug your query, to make sure it is what you expect and also check for query errors too. -
I do apologize, I misinterpreted the error. Try placing the block you had, above the included files, probably want to put it below "init.php" and above "header.php", also, turn on error reporting too. Error Reporting
-
When using "WHERE id = ?" you need to bind the id to ?. Where is the user's id coming from? A session variable?
-
Can anyone help with this save to mySQL database problem?
PaulRyan replied to jordan443's topic in PHP Coding Help
Firstly, you should turn on error reporting, you might be surprised what you find. Error Reporting -
Give it a try?
-
<?PHP if($_SERVER['REQUEST_METHOD'] == 'POST') { // Do stuff } ?>
-
The WHERE in your query should be searching against id and not firstname and lastname, you need to change it.
-
File Upload - Image Resize and Saves in Image Folder
PaulRyan replied to jillianmarie's topic in PHP Coding Help
Bitching? Where? Just a friendly debate. I gave the OP some advice on an earlier post I believe.- 14 replies
-
- file upload
- upload
-
(and 3 more)
Tagged with:
-
File Upload - Image Resize and Saves in Image Folder
PaulRyan replied to jillianmarie's topic in PHP Coding Help
I think you'll find I do understand PHP, you just don't understand English fully. He first has to upload the image, via a form (He doesn't have a problem with this, otherwise he'd have said so) Secondly, he wants to re-size any image that is above 1,500px, so it will work with his image slideshow (This is where he is stuck) You also don't understand JavaScript, you can't re-size an image using JavaScript. You can make it look smaller, but you can't physically change it's dimensions. You need to use PHP to find the ratio of how to scale the image, then save the image in the correct dimensions (All done by PHP)- 14 replies
-
- file upload
- upload
-
(and 3 more)
Tagged with:
-
You are trying to return the users "firstname" and "lastname", by querying their "firstname" and "lastname". Should you be using the "id" to return the data you want. Use the $user_id variable to search the database and return the data.
-
File Upload - Image Resize and Saves in Image Folder
PaulRyan replied to jillianmarie's topic in PHP Coding Help
"How can I upload a bigger image and resize it" - Take note of the red text.- 14 replies
-
- file upload
- upload
-
(and 3 more)
Tagged with:
-
File Upload - Image Resize and Saves in Image Folder
PaulRyan replied to jillianmarie's topic in PHP Coding Help
That is correct, but the OP didn't state an issue with the actual upload. He/she stated an issue with the image dimensions.- 14 replies
-
- file upload
- upload
-
(and 3 more)
Tagged with:
-
File Upload - Image Resize and Saves in Image Folder
PaulRyan replied to jillianmarie's topic in PHP Coding Help
Yes really, you obviously didn't read the question properly. He wants larger images to be re-sized to 1,500px or less to work in the image slideshow.- 14 replies
-
- file upload
- upload
-
(and 3 more)
Tagged with:
-
He probably has a dynamic I.P. address, which is very common in this day and age. There isn't much you can really do about it, you need to tighten up registration form, look at form tokens, re-captcha, also Google some tips to make forms less likely to be automated by a bot/script.