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,
Aggressive caching of generated contents while maintaining auth info
I’m using a Symfony 2 to generate my pages from data in a MySQL database. For most content, users have to be authenticated but the content itself does not change often and does not need to be …
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…
How to print SQL statement in codeigniter model
I have a sql statement in my model, I then say $query = $this->db->query($sql, array(fields, fields1); if ($query) { return true: } else { echo “failed”; return false; } My query …
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…