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 =...
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 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
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...
Hi. It has been over 35 years since I wrote my last Fortran program and that was in Fortran IV and on punched cards! I have just installed gfortran (Fortran 95) on my Linux box and have written my first simple program:
program f2c2f
! convert degrees C to F and F to C
implicit none
real :: x...
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.