I am trying to grab the MAX number of an INT column. When I run the query in phpmyadmin, it works fine. But when I put it in my PHP code, it keeps returning 0. I think my problem is I dont know how to grab it from the query properly. Specifically im using mysql_result, but after reading its syntax,
Tag: php
How to return a file in PHP
I have a file /file.zip A user comes to /download.php I want the user’s browser to start downloading the file. How do i do that? Does readfile open the file on server, which seems like an …
How to Convert Arabic Characters to Unicode Using PHP
I want to to know how can I convert a word into unicode exactly like: http://www.arabunic.free.fr/ can anyone know how to do that using PHP considering that Arabic text may contains ligatures? thanks Edit I’m not sure what is that “unicode” but I need to have the Arabic Character in it’…
PHP json_encode encode a function
How to encode a Javascript function in PHP? I want to encode the callback function with array equivalent ini Javascript: I know my PHP code is wrong, how can I fix it? Answer Viola i solved my problem with Zend_JSON encoder
AJAX + jQuery variables do not pass to PHP
I am trying to do something very simple: Pass 2 text variables to a php script and insert them into a MySQL db. For some reason however I can’t get the variables to pass (so I just get empty records in my DB). And the PHP: Anyone willing to take a quick look at it and point out my -probably
Send string as a file using curl and php
I know I can use this syntaxt to send a file using php, post and curl. $post = array( “file_box”=>”@/path/to/myfile.jpg”, ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); How can I take a …
Get value of dynamically chosen class constant in PHP
I would like to be able to do something like this: This doesn’t work. Is there a straightforward way of doing something equivalent? Note that I’m stuck with the class; it’s in a library I can’t rewrite. I’m writing code that takes arguments on the command line, and I would really…
PHPMailer could not connect to SMTP host
getting following error: SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: No such host is known. (0) SMTP Error: Could not connect to SMTP host. There was a problem sending this mail! This is my config file setting as I have followed this PHPMailer tutorial and used…
Search for highest key/index in an array
How can I get the highest key/index in an array with php? I know how to do it for the values. E.g.: from this array I would like to get 10 as an integer value: I know how I could code it but I was asking myself if there is a function for this as well. Answer This should work
Page redirect after certain time PHP
There is a certain PHP function for redirecting after some time. I saw it somewhere but can’t remember. It’s like the gmail redirection after logging in. Please, could anyone remind me? Answer this is the php way to set header which will redirect you to wherever.php in 5 seconds Remember that head…