-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
$limit = 'LIMIT 0, 20'; mysql_query("SELECT * FROM ... {$limit}"); // blah blah // do some stuff! mysql_query("SELECT COUNT(*) as Num FROM ... {$limit}"); If you were wanting to pass the start value in the URL like say: "?start=20" you could use: $start = (!$_GET['start']) ? 0 : (int) $_GET['start']; $limit = 'LIMIT {$start}, {$start+20}'; (no code tested) Adam
-
I imagine you're to use a MySQL database? http://www.tizag.com/mysqlTutorial/ That will introduce you to MySQL and creating DB applications with PHP. Adam
-
Yeah I was going to say, proper CVS files should have quotes around fields that contain commas (aparently).. I weren't aware of MySQL statements for loading CSV though, I imagine they'd be a lot easier! Adam
-
Yeah.. It's just designed to make more sense when you read it back.. I believe..
-
Just use PHP to work with the data. I don't know CSV backwards at all and I've never tried this before but just try something like: $rows = explode("\n", $csv_src); foreach ($rows as $row) { $cols = explode(",", $row); $insert = mysql_query("INSERT INTO ... (field1, field2, field3) VALUES ('{$cols[0]}','{$cols[1]}','{$cols[2]}')"); } Obviouslly you'll need to play around with it.. might need to use a second foreach loop to build the query string or something but good start! Adam
-
Hah some clever clog will figure it out if they really wanted.. i imagine? Have you tried going to captcha.php in your browser and seeing if you get an error? Adam
-
Well you need to store the captcha code in a seperate PHP file, perhaps named "captcha.php"? then display it as normal image: <img src="captcha.php" alt="Enter what you see!" /> Not true. Some talented people out there can create font recognition scripts to read the text - which is why they're always adding squiggly lines and very hard to read fonts. Didn't google mail's captcha image get broken a little while ago?
-
You could use regular expressions to extract everything between PHP tags and then eval the code..? But I'd stored the files in an unaccessible location just for a lil' security - ie. not in 'htdocs' .. Adam
-
He's talking about the search engine included with SMF .. the one in the top right of this page.
-
signal handling in an object in a forked process
Adam replied to shapeshifter's topic in PHP Coding Help
Well can't really say, would need to see some code pal! -
Be best to have them set their language at the start and store it in a cookie, that way you can just check the cookie... Adam
-
Well when you develop the code just indent as you go along. You generally indent code when it's encased with curly braces: function myfunction() { // encased once so 1 indent if ($this == $that) { // encased twice so 2 indents } } There are a few exceptions which don't follow that, like when using a switch () .. but genrally anything encased just gets an extra indented. You'd be best following a coding standard, like PEAR's: http://pear.php.net/manual/en/standards.php .. can't go far wrong with following that! Indention is purely for readbility of the developer.. Adam
-
Fair point ILMV .. Anyway, coming back to his original question, your problem lies with your query. You need to look into using "LIMIT" in mysql.. For example: SELECT * from forumtutorial_posts where parentid='0' order by lastrepliedto DESC LIMIT 0, 10 That would display onnly the first 10 rows.. Adam
-
Hah well getting technical.. ?><table class='maintable'><?php should be.. ?><table class="maintable"><?php I think things like not printing HTML is just nit picking - never going to waste enough server resources to actually matter.. perhaps a microsecond or two, if that? Adam
-
Oh no sorry - it's early! Not thinking right.. I would hae thought it would work with what you have? Adam
-
foreach ($images as $imageArr) { foreach ($imageArr as $image) { echo '<img src="$image['name']" alt="$image['description']" title="$image['description']" />'; } } .. should do the trick!
-
if(isset($_POST['submit'])) { There you are testing to see if the submit button has been pressed, but you haven't named the submit button "submit" .. Change: <input type="submit" value="Post Comment"> to: <input type="submit" value="Post Comment" name="submit"> Basically you're testing to see if an input named "submit'" has been sent to the script via the post method (think <form method="post" ..), yet you hadn't named the submit button "submit". Adam
-
Fix it in what way?
-
Yeah show us the formvalidator.js script ..
-
Because you're not using it, nothing happens in your if ($verify == ..... session_start(); if(isset($_POST['submit'])) { $verify = isset($_POST['verify']) ? strtolower($_POST['verify']) : ""; if ($verify != $_SESSION['verify']) { die('BAD IMAGE VERIFICATION!'); } } You'll want to find a neater way of doing it though.. Adam
-
Foxfire and IE6 loosing session. IE7 works as expected.
Adam replied to HeidiR's topic in PHP Coding Help
Probs because you had name=name without any quotes around "name" .. session_start(); print_r($_POST); print_r($_SESSION); $str = '<form method="post" action="' . $PHP_SELF . '">'; $str .= '<input name="name" type="text">'; $str .= '<input name="cmd" type="submit" value="Send">'; $str .= '</form>'; echo $str; $_SESSION['name'] = $_POST['name']; -
You'll need to look into AJAX to load external files. Take a look at these examples (mainly the top one): http://www.w3schools.com/Ajax/ajax_examples.asp Adam
-
To be honest mate I very much doubt you'll get anything like that for free. You'd either have to pay someone or create it yourself... Freelance forum: http://www.phpfreaks.com/forums/index.php/board,8.0.html Adam
-
Have you got another form tag opened but not closed anywhere on the page? Can't imagine it would be that but, worth a look! EDIT: ignore the last bit i said! Adam
-
Doesn't make any sense? I thought file1 had a form filled with data from a database? Not a form to control file2, which also gets data from a database?? ???