Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. Missing semicolon, line above ($result = mysql_query($sql))
  2. if(!mysql_query($sql, $connect) should be if(!mysql_query($sql, $connect))
  3. 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
  4. 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'].'...
  5. 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.
  6. 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'; ?>
  7. Technically, isn't the OP already doing that, and just needs to echo $i?
  8. You can't using just PHP Typically people use Flash to upload a file with a progress bar.
  9. 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
  10. Well, <?php $var = '$test'; echo $var; ?> Results with: What does it do/not do? - and a sample of your code would help
  11. Incorrect character set I'd imagine (never really had to worry about that myself) Use single quotes: echo '$15'; // echos $15
  12. 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
  13. Do you have session_start(); at the very top of the page you're trying to use the session with?
  14. Change $sqlmembers = mysql_query($qry); to $sqlmembers = mysql_query($qry) or die(mysql_error());
  15. Unknown column 'uname' in 'field list' That's in your insert query - and it means that cokumn doesn't exist in your database structure. Are you sure you have a 'uname' and not 'uName' or 'username' or something like that?
  16. http://php.meetup.com/42/ That's mine Overall calendar : http://php.net/cal.php
  17. Yeah, I'm the same way. The help/general discussion on HTML-Kit is laid out horribly in my opinion. I hate newsgroups/message boards like that! I guess I'm just a forum guy
  18. Both - although I feel I'm too much of a perfectionist, and instead of getting decent code out there, I keep making minor adjustments... thus it's never really complete (typically my own sites). However, when deadlines loom around, I can get it done within the time frame. xlyex - I just started meeting with some local programmers myself, and I must agree it helps a lot. I have to ask though, have you/do you attend any PHP meetings around? There is a group where I'm at, but I'm a bit hesitant about going for some reason
  19. I typically don't use it - I prefer using full syntax with braces. However, this application is a bit smaller than what I'm used to working on, so I don't think it will matter too much
  20. Oops, my bad, change foreach($row as $k => $v) { to foreach($array as $k => $v) {
  21. while ($row = mysql_fetch_array($query)) { $username = $row['username']; $email = $row['email']; $count++ ; } if($numrows > 1){ $return = "results";} else{ $return = "result"; } print "<p>Your search for $search returned $numrows $return.</p>"; print "$email<br>$username"; That loop will only set the last row found. You need to either create an array, each array item being an array of the results, or print directly from the loop. $array = array(); while($row = mysql_fetch_array($query) $array[] = $row; $return = (($numrows>1) ? "results":"result"); // if there should be an s or not print "<p>Your search for $search returned $numrows $return.</p>"; // show string foreach($row as $k => $v) { // run loop through each array element echo 'Email: ',$v['email']; echo 'Name: ',$v['username'],"\n"; }
  22. is incorrect syntax (I believe) Changing $query = mysql_query($sql); to $query = mysql_query($sql) or die(mysql_error()); would have helped
  23. I haven't used it, but I'll honestly say I think it's a waste of money. If done properly, typically a majority of your code can be re-used from other projects. Also, there are tons of open-source stuff that does the same thing (and more!) and they are 100% FREE! Which would save you what, $400-600!?
  24. Oops, sorry I should be in bed sleeping instead of surfin' the web
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.