Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
But it's out in the open, not in a query or variable You need first connect to the database, then run a query on that. $res = mysql_connect($host, $user, $pass) or die(mysql_error()); mysql_select_db($db, $res) or die(mysql_error()); mysql_query("SELECT `page_id` AS s, `link` AS c, `vid_title`, `vid_desc`, `hidden` FROM `'.$opts['videos'].`", $res) or die(mysql_error());
-
if(!($res = mysql_query("$host", "$user", "$pass") or die(mysql_error()); mysql_select_db("$db") or die(mysql_error()); 'SELECT `page_id` AS s, `link` AS c, `vid_title`, `vid_desc`, `hidden` FROM `'.$opts['videos'].` First of all you have a query where you probably meant connect. Secondly, why is the following there? 'SELECT `page_id` AS s, `link` AS c, `vid_title`, `vid_desc`, `hidden` FROM `'.$opts['videos'].`
-
I'd image with the practically endless types of zipcodes, that would be impossible, not to mention some countries don't have postal codes. The best thing to do what have the end-user narrow it down to what country - then out of several zipcode databases, you'd pull it from one. Take a look at this page for more reasoning why it'd seem impossible: http://en.wikipedia.org/wiki/List_of_postal_codes
-
http://www.phpfreaks.com/forums/index.php/topic,208965.0.html Has UK at the end of the post I believe.
-
D'oh! this link is for corbin
-
Yeah, I love SMF because of some of the features, but it can be hard to navigate. I joined the SMF Documentation team for a little while in hopes to maybe improve their documentation (almost none on how to create a mod or theme) but my interest didn't last very long.
-
Agreed - I've probably learned more just by researching interesting problems and finding solutions to them than I have by reading or by someone trying to spoon feed me information. I freelance on the side, and this (as Maq said) helps keep me sharp. I don't really get bored on this site, there always an interesting question somewhere - even if it's not in the PHP Help section. Do I get fed up? It's rare, but yes. When the OP is stubborn and won't try anything but his way, I tend to get frustrated (as I do with my clients that do the same, although I don't show it around them ) As for steering - I try to do the same, will give them hints about what's wrong, or ask them "Do you see the difference between this and that?" But most of the time I have the code handy for when I feel they deserve it Oh - and I should ask, why do teachers become teachers? (At least here in the States it's not about the pay )
-
how to translate a php script to another language ?
Philip replied to samoi's topic in PHP Coding Help
oh my... -
Happy mother's day to everbody's mum and mother's
Philip replied to redarrow's topic in Miscellaneous
Hallmark holiday. -
<?php phpinfo(); ?> Will tell you everything you need to know about your PHP setup. Otherwise you can just call: <?php echo 'Current version is ',phpversion(); ?> Fread/fseek - again, I'm not sure about this one $fp = fopen($IP_file,"a+"); #works fine fseek($fp, 0);
-
[SOLVED] Need some help with PHP/MySQL Bookstore
Philip replied to sstoveld's topic in PHP Coding Help
Missing semicolon, line above ($result = mysql_query($sql)) -
if(!mysql_query($sql, $connect) should be if(!mysql_query($sql, $connect))
-
[SOLVED] Need some help with PHP/MySQL Bookstore
Philip replied to sstoveld's topic in PHP Coding Help
SELECT id, title, stock, price FROM stock LEFT JOIN books ON stock.title_id = books.id ORDER BY title SELECT books.id as id, title, stock, price FROM stock LEFT JOIN books ON stock.title_id = books.id ORDER BY title -
[SOLVED] Need some help with PHP/MySQL Bookstore
Philip replied to sstoveld's topic in PHP Coding Help
Erm... You have <?php echo 'This is a test! '.$row['id'].' <-Did you see anything?; ?> Inside your echo statement should be: echo '<tr><td>'.$row['title'].'</td><td>'.$row['stock'].'</td><td>'.$row['price'].'</td><td>This is a test! '.$row['id'].'... -
There are a few things I noticed - not sure if any of them would be the cause. It's been a while since I've had to manipulate files in PHP/C... but 'a+' mode puts the pointer at the end of the file.
-
[SOLVED] Display row number column - NOT mysql row number
Philip replied to tommy445's topic in PHP Coding Help
Hahaha, it's cool man -
Personally I almost always use absolute paths. Typically it will be something like: /home/username/www/blah/file.php If you're going to use it one level up, here's what I would do: define('PATH', str_replace('lettera','',dirname(__FILE__)).'includes/'); include PATH.'header.php'; Same thing as above, just broken down into manageable chunks: <?php // Get the current path $currentPath = dirname(__FILE__); // Strip out the top folder (if it exists) $strippedPath = str_replace('/lettera','',$currentPath); // And instead, add in the includes $includePath = $strippedPath.'/includes/'; // Now use the variable in your include include $includePath.'header.php'; ?>
-
[SOLVED] Display row number column - NOT mysql row number
Philip replied to tommy445's topic in PHP Coding Help
Technically, isn't the OP already doing that, and just needs to echo $i? -
How do I create a php upload with progress bar?
Philip replied to xenoalien's topic in PHP Coding Help
You can't using just PHP Typically people use Flash to upload a file with a progress bar. -
I also do a similar setup, in reverse. Super admins get 255 Admins get 200 Mods 100 Normal users 1+ Banned 0 Then on permissions: if($user >= 100) // mod area if($user >= 200) // admin area
-
Well, <?php $var = '$test'; echo $var; ?> Results with: What does it do/not do? - and a sample of your code would help
-
Incorrect character set I'd imagine (never really had to worry about that myself) Use single quotes: echo '$15'; // echos $15
-
It should be like this: main.php <?php session_start(); include somefile.php; echo 'hi'; ?> somefile.php <?php echo $_SESSION['name']; ?> Also, add error_reporting(E_ALL); at the very top of your script
-
Do you have session_start(); at the very top of the page you're trying to use the session with?
-
Change $sqlmembers = mysql_query($qry); to $sqlmembers = mysql_query($qry) or die(mysql_error());