harristweed
-
Posts
346 -
Joined
-
Last visited
-
Days Won
1
Posts posted by harristweed
-
-
all lines need to be closed with a semi-colon;
-
I have an export that I use, here is the code, it might point you in the right direction:
<?php include("variables.php"); $link_id = mysql_connect("$db_host","$db_user","$db_password"); if (mysql_select_db("$db_database", $link_id)); else { echo "connection failed."; } $select = "SELECT club_nr, first_name, surname, email, address1, address2, postcode, town, province, phone FROM members"; $export = mysql_query($select); $fields = mysql_num_fields($export); for ($i = 0; $i < $fields; $i++) { $header .= mysql_field_name($export, $i) . "\t"; } while($row = mysql_fetch_row($export)) { $line = ''; foreach($row as $value) { if ((!isset($value)) OR ($value == "")) { $value = " \t"; } else { $value=stripcslashes($value); $value = str_replace('"', '""', $value); $value = '"' . $value . '"' . "\t"; } $line .= $value; } $data .= trim($line)."\n"; } $data = str_replace("\r","",$data); if ($data == "") { $data = "\n(0) Records Found!\n"; } header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=bridge_club_members.xls"); header("Pragma: no-cache"); header("Expires: 0"); print "$header\n$data"; ?>
-
Well, as I said, it worked for me.
-
I did this some time ago and it seemed to work!
set $i=0 outside of the 'loop'
then have this code inside the 'loop'
$i++; $nl=$i % 100; if($nl==0)echo"<br />$i Records processed<br />"; echo"|"; ob_flush(); flush();
-
$cDiff = mysql_query("SELECT COUNT(DISTINCT cCode) AS number FROM onlinenow");
-
I’d tackle your requirement like this….
<?php // date function function date2mysql($date){ $day=substr($date,0,2); $month=substr($date,3,2); $year=substr($date,-4); $date=$year."-".$month."-".$day; return $date; } //has the form been posted? if($_POST['submit']=="submit"){ //Get the old customer total $customer_count = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM table_name WHERE condition' "),0) ; // format the date and add posted info to database $date_to_mysql=date2mysql($_POST['datepicker']); //update database with post infomation $number_customers = $new_customers + $customer_count; //display totals echo "<p>Total customerrs =".$number_customers."</p>\n"; }else{ //display form echo "<form id=\"form\" action=\"$_SERVER[php_SELF]\" method=\"post\" >\n"; ?> <input type="text" name="form_stuff"> <input type="submit" name="submit"> </form>
-
I’m still confused! Do you want a single page (form) that displays information from the database with the option to add more items or edit the existing ones?
-
I change the date value, using the function after the form has been submitted. The received post values are inserted into a mysql database after they have been sanitised and the function applied to the date variable!
-
I have a datepicker that is formatted to show dates dd/mm/yyyy to add them to mysql database I use a function to 'amend' the format:
function date2mysql($date){ $day=substr($date,0,2); $month=substr($date,3,2); $year=substr($date,-4); $date=$year."-".$month."-".$day; return $date; }
perhaps you could do something similar....
-
<?php if($_POST['formSubmit'] == "Submit") $varUserName = $_POST['username']; $varPW = $_POST['PW']; $varEmail = $_POST['email']; { $fs = fopen("testcsv.csv","a"); fputcsv($fs, array("$varUserName","$varPW","$varEmail","user","title",",category","some text '<a href=\"http://$varUserName.url.com/splash/\">site.com</a>'")); fclose($fs); exit; } ?>
-
try changing this line. to this:
$query .= "WHERE branch = '$branch' ";
-
-
<?php $array1 = array(1, 2, 3); $array2 = array(4, 5, 6); $array3=array_merge($array1, $array2); foreach ($array3 as $key => $value) { echo"key = $key value = $value<br />\n"; } ?>
-
I think that you can't use a GET in the query, Try
$id=$_GET['id']; $sql = 'SELECT `car_year`, `car_name`, COUNT(*) as `total` FROM `company_inventory` WHERE owner_name = '.$userdata['user_name'].' AND warehouse_id = '.$id.' GROUP BY `car_name`, `car_year` ORDER BY `car_name` ASC'; $result = mysql_query($sql) or trigger_error($sql . ' has an error<br />' . mysql_error());
-
Possibly:
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
Might be the reason, why not try:
$headers .= "Content-Type: text/html; charset=UTF-8\n";
-
-
post full code - error might be before this line
-
try:
<?php if(!empty($errors)){ echo '<form action="confirmation.php" method="POST">'; }else{ echo '<form action="register.php" method="POST">'; } ?>
-
I can see two errors:
// Must contain all legal characters if (strspn($_POST['user_name'],$span_str) != srnlen($name)) { return false; }
spelling mistake,
should be:
// Must contain all legal characters
if (strspn($_POST['user_name'],$span_str) != strlen($name)) {
return false;
}
and
if strlen($_POST['user_name']) > 25 { return false; }
missing brackets:
if (strlen($_POST['user_name']) > 25) { return false; }
-
They have an answer phone and don't respond to email.
-
I receive, on average 200 spam emails a day. There is a commercial company spamhaus http://www.spamhaus.org/ that sell their services to ….i’m not sure who. My outgoing email is blocked by this company most of the time, which is at best very inconvenient . I have never sent spam. This company claim to be fighting spam. Their system clearly does not work but I am subject to the restriction they impose. They are a big fraud. I must admit, I am very angry and would resort to an action I would not be proud of if I met an employee of this racket. Does anyone know how I can strike back?
-
It looks like the error is on line 81. There is a closing brace and no opening brace above it. I think that there should be something like:
<?php if($_POST['submit']=="submit") { ?>
at the top of the code...
-
$info = mysql_fetch_array($data);
Should be:
$info = mysql_fetch_array($data, MYSQL_ASSOC);
http://es2.php.net/manual/en/function.mysql-fetch-array.php
but I think better to use:
$info = mysql_fetch_assoc($data);
-
have you got a file named 'authorize_1.php' in the same folder as your authorization script?
php mysql error for the right syntax to use near
in PHP Coding Help
Posted
I agree with PFMaBiSmAd:
Try this: