-
Posts
24,563 -
Joined
-
Last visited
-
Days Won
822
Everything posted by Barand
-
How are you getting the list of ids for selection in the first instance?
-
It seems like you need to to learn the basics of HTML before you embark on PHP to produce web pages
-
Post your code. Use the <> button above.
-
echo mysql_error() after code to see if an error occurred
-
try $favourites = array(); $fh = fopen('test.txt', 'r'); $line = fgetcsv($fh, 1024); // header while ($line = fgetcsv($fh, 1024)) { $data = $line[9]; $favourites = array_merge($favourites, explode('|', $data)); } $favourites = array_map('trim', $favourites); $counts = array_count_values($favourites); arsort($counts);
-
Was it too difficult to paste a couple of sample lines, or to punctuate that reply to show birth and date are one field (I assume anyway)? If you can't be bothered to give better information, why should I?
-
What does data.csv look like?
-
trim
-
try $data = file('test.txt'); $teams = array(); foreach ($data as $line) { $teams = array_merge($teams, explode('|', $line)); } $teams = array_map('trim', $teams); $counts = array_count_values($teams); arsort($counts);
-
You should read the manual re mysql_fetch_row or mysql_fetch_assoc
-
gingerjm, you really should take your own advice
-
With that csv file list($state, $balance) = $data; will put Account and State into $state and $balance. try list(,$state,,,,,$balance) = $data;
-
It doesn't matter if you use $row, $row1 or $slartybartfast. Just be consistent. You can't use use $row for some fields and $row1 for others in the same while loop.
-
Is it because you are using $row1 in the loop?
-
A. What format are those columns? B. What have you tried?
-
Read the replies
-
Prior to 5.4 it works only if short php tags are enabled. From 5.4 it works regardless of the short tag setting
-
Use a table JOIN SELECT p.prod_name, p.prod_photo, pr.prod_price FROM tblproduct p INNER JOIN tblretprod pr ON p.prod_id = pr.prod_id ORDER BY RAND() LIMIT 6
-
No. If you want it sorted by id use ... ORDER BY id
-
my preferred method Code tags appear to be FUBAR so here it is without them $db = new mysqli(HOST, USERNAME, PASSWORD, DATABASE ); $sql = "SELECT pat_id as `Patient ID` ,pat_lname as `Patient Last Name` ,pat_fname as `Patient First Name` ,pat_date as `Date` ,office_name as `Patient Location` ,pat_ins ,pat_show FROM patients INNER JOIN offices ON office_id = pat_loc INNER JOIN insurance ON ins_id = pat_ins "; sql2csv($db, $sql, 'mydata.csv', 1); // // function to download csv // function sql2csv($mysqli, $sql, $filename='', $headings=1) { if (!$filename) $f = 'download_' . date('ymdhi') . '.csv'; else $f = $filename; if ($fp) { $res = $mysqli->query($sql); if ($res) { header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="'.$f.'"'); header('Pragma: no-cache'); header('Expires: 0'); $row = $res->fetch_assoc(); if ($headings) { fputcsv($fp, array_keys($row)); } do { fputcsv($fp, $row); } while ($row = $res->fetch_assoc()); } else echo "Error in query"; fclose($fp); } }
-
When you get to the answer page, $_POST['ans1'] no longer exists so you are clearing the session value. You need to store $_POST['ans11'] on that page.
-
UPDATE table1 INNER JOIN table2 USING (id) SET table2.date = table1.date Also change your date fields to type DATE, format YYYY-MM-DD. Your format is useless in a database
-
Store them as DATE, DATETIME or TIMESTAMP types. Formats are YYYY-MM-DD HH:ii:ss for datetime and timestamp and YYYY-MM-DD for date type Using these types will give maximum functionality (usable by the date/time functions in MySql and can be easily sorted/compared)
-
Ecommerce Website - Creating Categories For Items
Barand replied to BorysSokolov's topic in PHP Coding Help
EG item | cat ----------- 1 | 10 1 | 11 1 | 12 2 | 1 3 | 2 3 | 10 3 | 12