The mysql_* functions were deprecated some years ago and don't even exist in the latest version of PHP. It is better to use mysqli_* or PDO.
I'm not a number, I'm a free man
There's a migration guide at http://php.net/migration55 for upgrading 5.4 to 5.5 and another for upgrading 5.3 to 5.4. These may help you find what to look for.
I'm not a number, I'm a free man
Hi. I'm new to Python, trying to teach myself. I have the following script which works fine but I'm wondering if there are better ways of doing some things.
print("Content-type:text/html\r\n")
import cgi, cgitb
form = cgi.FieldStorage()
# Get data from form fields
# text fields
tname =...
Thanks for your reply. Is using fethcAll() and a foreach loop really more efficient than fetch() and no foreach loop? It sounds counter-intuitive.
I'm not a number, I'm a free man
Okay. Dimwit that I am, this seems to do the job:
$query = 'SELECT * FROM talks WHERE id=:id;';
$stmt = $db->prepare($query);
$stmt->bindValue(':id', $id);
$stmt->execute();
$result = $stmt->fetch();
$address = $result['address'];
$num_views = $result['num_views'];
I'm not a number, I'm a...
I'm using SQLite and I have the following to get a single record:
$query = 'SELECT * FROM talks WHERE id=:id;';
$stmt = $db->prepare($query);
$stmt->bindValue(':id', $id);
$stmt->execute();
$result = $stmt->fetchAll();
foreach ( $result as $row ) {
$address = $row['address'];
$num_views =...
I have a script that uploads and if necessary resizes an image. It works fine except that if the uploaded image is not the same aspect ratio as the source image it gets distorted. Can anyone help me work out what I need to add to change the aspect ratio please?
$image =...
I've tried
$query = 'SELECT count(*) FROM talks;';
$result = $db->query($query);
which I assume is much the same thing? But then I need to get the value out of $result!
I'm not a number, I'm a free man
I simply want to count the number of rows in a table. I have:
$query = 'SELECT count(*) FROM talks;';
but then how do I get the result of the select? I'm using PDO.
Thanks
Hi Chris, should that be:
<?php
if (condition) {
write something to the string or do nothing
} else {
write "OR" to the string followed by something else
}
?>
I'm not a number, I'm a free man
I have a website with SEO-friendly URLs (for example, contact-us rather than contact-us.php)
I have the following commands in my .htaccess file which directs all the pages correctly.
RewriteEngine on
RewriteRule ^([-A-Za-z0-9]+)$ $1.php [PT,L]
I would also like, if possible, to direct...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.