Jump to content

rohitbanerjee

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rohitbanerjee's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I am having some issues with 2d arrays in PHP. $1d_arr = array('a', 'b', 'c'); foreach($1d_arr as $elem){ $elem = array(); } $sql = 'SELECT letter, num FROM table'; $result = $db->query($sql); while($row=mysql_fetch_array($result)){ array_push($1d_arr[$row['letter']], $row['num']); } This seems to be working but each array_push call is throwing a warning that the first argument has to be an array but null is being passed.
  2. htmlspecialchars() worked -- thanks guys
  3. Hey guys, So when I put the following line of php on an html page: echo '&reg'; I get the 'Registered' symbol. How do I turn this off? What is happening is that it is part of a longer string that represents an url and the URL is not rendering correctly due to the special character. Thanks
  4. Thanks for the help guys -- apparently GoDaddy internally throttles the amount of data you can fetch. I will update this forum with my results.
  5. So I have some php code within an html page (using Apache v2.2, PHP v5.2) that uses MySQLI to connect to a database and fetch some rows from a database. Everything works fine so long as I limit the number of rows fetched, if I try to fetch all the rows, I get a 500 Internal Server Error in my browser. I am using GoDaddy Hosting -- has anyone encountered this problem/know what the hell is going on?
  6. Wow, thanks -- makes me feel like an idiot
  7. Hello, I can't really explain it so a example will be better: my_table: col1 col2 col3 col4 1 1 23 A 2 1 25 A 3 2 21 B 4 3 24 A 5 3 28 A the query is-- SELECT col3 FROM my_table WHERE col2=SELECT(MAX(col2) FROM my_table WHERE col4='A') For some reason this is illegal, I can also not use a limit because the number of rows is not known a priori. I remember seeing some sort of redirection in some other forum but would appreciate a more explicit response. Thanks This is not legal for some reason -- is there a way
  8. Thanks for all the input -- turns out DISTINCT(col3) works pretty well.
  9. So suppose I have a mysql table like the following Col1 Col2 Col3 Row1: A 10 2012-3-21 13:20:09 Row2: A 12 2012-3-20 12:04:09 Row3: A 5 2012-3-20 12:03:03 I need a query which will fetch me Row1 and Row2 given that I am searching for A, if the query sees that two rows occur on the same date, it should return the latest one. Any thoughts?
  10. I actually found that exact same webpage and am pretty convinced the error is the second bullet point -- I've fired this off to the godaddy support staff and hopefully resolve this thing. Thanks for the help and sorry for the misunderstanding earlier
  11. Nope, same issue -- by binding did you mean before bind_param or bind_result. I tried it before both and no result. I think you may be right regarding timeouts -- I checked the apache logs and it seems that everytime I tried to visit the error, there was a response of 500 408. 408 meaning that the website did not respond fast enough, presumably because of the mysql fetches?
  12. No, no you misunderstood my response. There are multiple rows with the same user id.
  13. I don't know what to tell you .. $Statement->fetch() will fetch a row. while($Statement->fetch()) will keep fetching rows until there are no more rows to fetch. http://www.php.net/manual/en/mysqli-stmt.fetch.php That's from the php manual, look at the last example.
  14. Yeah, but you only inserted one thing into the table. If you inserted multiple things then fetch would return multiple rows. Fetch exits when there are no more rows to fetch.
  15. Actually there is another error: Premature end of script headers: <file>.php
×
×
  • 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.