Jump to content

Fruct0se

Members
  • Posts

    108
  • Joined

  • Last visited

    Never

Everything posted by Fruct0se

  1. Ok I figured it out...not enough caffeine in my system today. I was using mysql_fetch_row when I should have been using mysql_fetch_assoc
  2. This always works fine except for some reason when using the LIKE statement. I am trying to return a group of rows and call them out by their column names. So if I have a column called NAME then when extracting the row I normally can reference that result by echoing $NAME, when using the like statement it is returning 0 and 1 etc... for the column names, any ideas? <?php $result = mysql_query("Select * from images where NAME like '$search%'"); while($i = mysql_fetch_row($result)){ //This for each will echo: 0 NAMEofIMAGE foreach ($i as $name=>$val) { echo "$name is a $val <BR/>"; } //This will echo nothing for the $NAME because the query is not returning the column names extract($i); echo "<b>Name: ".$NAME."</b><br/>"; } ?> Like I said, without the LIKE statement the column names are returned and when extracted can be used. Thanks for the help.
  3. <td class="thead" width="50%" align="left"><a href="YOUR LINK"><?php print $title; ?></a></td>
  4. Ok I figured it out: I had to log into ssh bash and go to the mysql terminal. Then I had to add privileges to the user trying to access the database from a different domain. For anyone that is interested these are the commands used: CREATE USER 'username'@'IP' IDENTIFIED BY 'username'; GRANT SELECT , INSERT , UPDATE , DELETE , CREATE , DROP , FILE , INDEX , ALTER , EXECUTE ON * . * TO 'username'@'IP' IDENTIFIED BY 'password' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; GRANT ALL PRIVILEGES ON `database` . * TO 'username'@'IP'; The above will create a user, give permissions on that IP to access the DB as well as permissions to modify it.
  5. if your just trying to get the results from the query where it matched then add the following lines after your query: $result=mysql_query($query); while ($row = mysql_fetch_row ($result)) { extract($row); echo "$text<br/>"; }
  6. I havent tested but this should work or at least point you to what your trying to do: $query="SELECT moj_genre, genre_id FROM genres, genrelinkcd WHERE genre.genre_id = genrelinkcd.moj_id AND genrelinkcd.moj_id='$id'"; $result=mysql_query($query); while ($row = mysql_fetch_row ($result)) { extract($row); echo "moj_genre: $moj_genre, genre_id: $genre_id"; }
  7. Do a view source on the page that shows the login for your webmail. You should see what the fields are called for the username and password as well as where they are posting to. Then all you have to do is replicate that form anywhere you want on your site.
  8. I have a dedicated server which I can access through PLESK... I have two seperate sites, one is a .com and the other a .mobi for cell phone users. Is there a way that both sites can access the same db? The main DB is on the .com but it appears that each site is given its own seperate db's I thought using just localhost since it was on the same machine it would work but it does not, any ideas would be great.
  9. The problem is not actually php. Try setting some fixed widths for your tables, so everywhere you have <td> change it set the width you want: <td width="200"> This will fix the width of each cell, right now your table is only going to be the size of whatever is inside it.
  10. Thanks, can you show me an easy way to show all the data in the array?
  11. I am pulling a table from my database and I would like to store all of the information into a single array. The table would look something like this: table name: taxonomy IDCategoryidHidW 1Standard100300 2Standard200320 3Standard300390 4Other1030 5Other23020 6Other33010 I would like to store all of this information into a single array something like: $result = $db->query("Select * from taxonomy"); while ($i = $db->fetch_row($result)){ extract($i); //!*****Want to store all the data into a single array here***** }
  12. 10k seems a bit high to me as well, even 2500. Unless of course the site already has a decent amount of traffic coming its way.
  13. This is actually most likely working, however you have both + and - in the same form so when you submit it both + and - will be set. This means that your code will add 1 then immediately subtract 1.
  14. echo "<td>City Search:</td>"; echo '<td><select Name="A_City">'; for($i=0;$i<=$nbcities;$i++) { echo '<option value="'.$cityset[CITY_ID][$i].'">'.$cityset[CITY_NAME][$i]."</option>\n"; } echo "</select>";
  15. if ($limit_end) { $result = mysql_query("SELECT * FROM zip_code where `state_prefix` = 'OK' OFFSET $limit_end") or die(mysql_error()); } else { $result = mysql_query("SELECT * FROM zip_code where `state_prefix` = 'OK'") or die(mysql_error()); } This way we only offset after the first round, forgot that $Limit_end would have no value until it was run the first time through. Just caught something else: $limit_end++; while($myrow = mysql_fetch_array ($result)) Make the $limit_end inside your while loop: while($myrow = mysql_fetch_array ($result)) { $limit_end++;
  16. I did this quick so hopefully all is good, see if this works for you. <?php if ($_GET['limit_end') { $limit_end=$_GET['limit_end']; } ini_set('max_execution_time', '999'); // example of how to use basic selector to retrieve HTML contents include('simple_html_dom.php'); $source_file = "C:/Inetpub/Websites/edit.com/echo.txt"; $fp= fopen("$source_file", "a"); $other="\n"; $db = mysql_connect('localhost', 'xx', 'xx') or die(mysql_error()); mysql_select_db('xx') or die(mysql_error()); $total_rows = mysql_num_rows(mysql_query("SELECT * FROM zip_code where `state_prefix` = 'OK'", $db)); $rows_per_loop = 25; // run the loop, while loop counter is less than the total number of loops: while ($s!=$rows_per_loop) { $s++; // get the numbers for the limit, // start is just the current loop number multiplied by the rows per loop // and end is loop counter + 1, multiplied by the rows per loop $result = mysql_query("SELECT * FROM zip_code where `state_prefix` = 'OK' OFFSET $limit_end") or die(mysql_error()); $limit_end++; while($myrow = mysql_fetch_array ($result)) { $zip=$myrow['zip_code']; // get DOM from URL or file $html=file_get_html("http://www.mysite.com/selector.php?transaction=search&template=map_search&search1=0&pwidth=400&pheight=700&proxIconId=400&proxIcons=1&search2=0&search3=1&country=US&searchQuantifier=AND&address=&city=&stateProvince=+&postalCode=$zip&radius=500&x=78&y=16"); $i = 0; $tmp = $html->find('span[class=mqEmp], span[class=Black11]'); $cnt = count($tmp) - 1; foreach($tmp as $e) { if($i > 0 && $i < $cnt){ $outputstring=$e->plaintext; $outputstring=$outputstring. "\t"; fwrite($fp, $outputstring, strlen($outputstring)); if ($i % 8 == 0) { fwrite($fp, $other, strlen($other)); } } $i++; if ($limit_end==$total_rows) { $s=$rows_per_loop; } } } // now that we've run those, let's clear the results so that we don't run out of memory. mysql_free_result($result); // show where we are at echo "$limit_end of $total_rows<br />"; sleep(1); // give PHP a little nap to keep from overloading server ob_flush(); // as recommended by MadTechie, in case we go beyond the max execution time flush(); // add flush, to make sure it is outputted if($limit_end!=$total_rows) { header( "location:http://www.edit.com/selector.php?limit_end=$limit_end" ); } } fclose($fp); ?>
  17. You will want to look into ajax to disply results as users type, and it involves java
  18. Here is an article on it: http://www.thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter
  19. $sql = mysql_query(sprintf("SELECT email FROM Member WHERE loginName=loginName='%s'", mysql_real_escape_string($_POST['username']))) or die (mysql_error()); if (mysql_num_rows($sql) > 0) { $row = mysql_fetch_assoc($sql); $sysmail = $row["email"]; i changed $row = mysql_fetch_assoc($result); to $row = mysql_fetch_assoc($sql); Your query would have been empty otherwise.
  20. It is a bit confusing.... are you sure $html=file_get_html("http://www.www.edit.com is correct? you have www.www??
  21. You want to make sure that the header is not updated until you finish with your SQL, I cannot tell what is going on in your code with what you provided here.
  22. Well it looks like it should work now as long as you changed the code I showed you in the post earlier.
  23. change: function register($subuser, $subpass, $subemail, $sublocation){ to: function register($subuser, $subpass, $subemail, $subgender, $sublocation){ then if($database->addNewUser($subuser, md5($subpass), $subemail, $sublocation)){ to if($database->addNewUser($subuser, md5($subpass), $subemail, $subgender, $sublocation)){ And now I need to see your database.php file to finish
×
×
  • 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.