Mysql

How do I alter a date field to insert the current date

I have a mysql table that every time I insert to I have to pass the date. How can I alter the table to auto insert the current date.

I'm using php but can alter the table straight through mysql.

in

Drupal Crash Warning: Got a packet bigger than 'max_allowed_packet'

Warning: Got a packet bigger than 'max_allowed_packet' bytes query: INSERT INTO

I'm getting this quite often almost every page view. I can sometimes get in and disable modules to try and get rid of whats causing it but so far no help

How to reuse the same query on the page

I have added my first php page to add a dynamic page but need to display the results of a my sql query in different sections.

For a menu to link to its own page and display a summary of each seperatly on the page.

<?php
$query
= mysql_query("SELECT * FROM descriptions");
while (
$row=mysql_fetch_array($query)){
  print
'<a href='more.php?id=' . $row['id'] . '">' . $row['name'] . '</a><br />';
}

?>

I know there are mysql results but nevery any in php

I have a query that never returns any results or errors. When I run the sql directly through phpmyadmin the results come back fine.

just trying to dump row right now to see whats coming back

<?php
$link
= mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!
$link) {
    die(
'Could not connect: ' . mysql_error());
}

$sql = "SELECT ProductID,Name FROM products WHERE ProductID > 5 ORDER BY ProductID DESC";
$query = mysql_query($sql);
while (
$row = mysql_fetch_object($query)){
var_dump($row);
}
?>

How do I stop double posts in php

I'm helping someone with an old someone else made admin program to add / edit / delete records

Some of the people working on it are always pressing the back and forward button and reposting the info multiple times. Is there a way keep this from happening?

not the real code but close enough

<form method="post" action="addrecord.php">
<input type="text" name="title" />
..
..
..
<input type="submit" value="Add Record" />
</form>

The addrecord.php page

<?
include_once('dataconnection.php');
$title=$_POST['title'];
more fields
.
.
.

Syndicate content