Jump to content

extrovertive

Members
  • Posts

    235
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

extrovertive's Achievements

Regular Member

Regular Member (3/5)

1

Reputation

  1. [quote author=AliasXNeo link=topic=110840.msg448723#msg448723 date=1160266939] Thank you for staying positive. I could not find a better forum to properly place this thread, I figured if it truly was in the wrong area a moderator could move it, but this best fits the subject as it's related to PHP and I am asking for help. I simply need ideas. Generally I can take two or three people's idea's and combine them togeter to form my own unique idea, but i'm not 100 other PHP programmers, and I can't come up with an idea that I can assure will please most of the population that attends my site. Whereas, when I have multiple ideas, I can please each one and have a better shot at getting more activity to my website due to it's unique idea. [/quote] A PHP site that utilizes Biometric as a form of user authentication. Biometric technique can include voice recognition, fingerprint recognition, face recogiton, etc. Just in case, a user forget their password (what they know), Biometric is based on what they are. No such PHP website has that - be the first!
  2. & = a reference pointer operator in PHP [code=php:0] $somevariable = "test"; $newvariable = &$somevariable; echo $newvariable . "<br />"; $somevariable = "test2"; echo $newvariable; [/code] That mean, whenever $somevariable changes, $newvariable also changes since it references $somevariable. Try that code. And then try ouputting thae code taking the & out.
  3. I'm also doing an experiement. How do I increment the max ID value in the table. I tried: UPDATE t SET ID = ID + 1 WHERE ID = (SELECT MAX(ID)  FROM t) but i get #1093 - You can't specify target table 't' for update in FROM clause
  4. [quote author=solarisuser link=topic=106423.msg425612#msg425612 date=1157062062] Hello, I am writing code for CPU Speed detection, and then inserts it into a MySQL DB.  I have finished this part. What I need help with: I need to look at my speed variable, which will be something like 500, 800, or 3000. For example, if the CPUspeed variable is set to 1700, I want it to be modified to 1800.  If its 1800, then leave it alone (or modify to 1800).  If its 1690, I want it to be 1600. If its 3000, I want it to be 3000.  If its 3110, I want it to be 3200. I will do the Mhz and Ghz distinction later. Thanks! [/quote] This is such a weird rounding. If you were rounding to the 10th place, 1750 = 1800. 1690 would be 1700...3110 would be 3100....but your specifications are different.
  5. SELECT `ID`, `name` FROM t ORDER BY ID ASC LIMIT 2, 1
  6. Buying a script to learn free open-source PHP? Hmmm...
  7. [quote author=me102 link=topic=106342.msg425154#msg425154 date=1156998288] My question is there an easyer way to get larg amounts of data from a sql database heres the code i'm using now. [code] $SQL = "select * from online_logs where forumid='$forum_id' order by `id` desc limit 1"; $result = mysql_query( $SQL ); while( $row = mysql_fetch_array( $result ) ) { $set_ip = $row["ip"]; $set_userid = $row["userid"]; $set_id2 = $row["id2"]; } [/code] instead of listing each row and giving them a value for ex. $set_ip = $row["ip"]; Any ideas? [/quote] If you already know what columns, you are getting, no need to use "select *..." just use $SQL = "select ip, userid, id2 from online_logs where forumid='$forum_id' order by `id`"; then to execute the query: [code] $result = mysql_query( $SQL );             while(list($set_ip, $set_userid, $set_id2) = mysql_fetch_array( $result ) ) { //something here } [/code] Or, if you want the column field to be a variable in your PHP script: [code] $result = mysql_query( $SQL );             while($row = mysql_fetch_array( $result ) ) {                  foreach($row as $variable=>$value)                  {                        $$variable = $value;                  }                  /*                   After the loop terminates, you'll have the variables                    $ip, $userid, $id2 with its respective values                   */                     //something here } [/code]
  8. I noticed some ppl use: [code=php:0] $cu_s_number = mysql_real_escape_string($_POST['cu_s_number']); $cu_s_sample = mysql_real_escape_string($_POST['cu_s_sample']); $cu_s_wt = mysql_real_escape_string($_POST['cu_s_wt']); $cu_s_tare = mysql_real_escape_string($_POST['cu_s_tare']); $cu_s_poste = mysql_real_escape_string($_POST['cu_s_post']); $cu_s_diff_value = mysql_real_escape_string($_POST['cu_s_diff_value']); [/code] However, within a form, if I would like to escape all the data, is this more efficient or is there a problem with this version below? [code=php:0] if(isset($_POST['submit'])) { array_pop($_POST); //remove the submit variable $_POST = array_map("mysql_real_escape_string", $_POST);   foreach($_POST as $variable=>$value)   {     $$variable = $value;   } } [/code]
  9. I see, ronverdonk. However, I rarely use select * from...since I always know what columns to select. [quote author=Jenk link=topic=106307.msg425097#msg425097 date=1156984801] Is up to you, but for your last comment - if you are needing to run stripslashes on your [i]database[/i] data, you are running addslashes or mysql_real_escape_string() one too many times on input. [/quote] Well, when you use mysql_fetch_assoc/array, you're getting data from the database right? So, why do you need to addslashes? It should be strip slashes, shouldn't it?
  10. In all of my PHP scripts when interacting with the mysql database, I always use mysql_fetch_row with list: [code=php:0] $query = "SELECT col1, col2, col3 FROM table"; $result = mysql_query($query) or die ("Error in table: " . mysql_error()); while(list($mycol1, $mycol2, $mycol3) = mysql_fetch_row($result)) {   echo $mycol1 . " " . $mycol2 . " " . $mycol3 . "<br />\n"; } [/code] To me, I think that's very efficient if you're just going to retrieve values from a table and just output it - assuming you know what columns you want to retrieve. Other methods: [code=php:0] while($row = mysql_fetch_row($result)) { echo $row['col1'] . " " . $row['col2'] . " " . $row['col2']. "<br />\n"; } OR while($row = mysql_fetch_row($result)) { $mycol1 = $row['col1']; $mycol2 = $row['col2']; $mycol2 = $row['col3']; echo $mycol1 . " " . $mycol2 . " " . $mycol3 . "<br />\n"; } [/code] The former requires you to output the value as an associative array rather than a single variable. The latter requires you to initialize the associative array to a local variable. The only advantage for using mysql_fetch_array or (mysql_fetch_array(MYSQL_ASSOC) )/mysql_fetch_assoc is to clean the up the column array first. Example: [code=php:0] while($row = mysql_fetch_assoc($result)) { $row = array_map("stripslashes", $row);    echo $row['col1'] . " " . $row['col2'] . " " . $row['col2']. "<br />\n"; } [/code] However, if you're not doing that...what's are the advantages/disadvantages of using list..with mysql_fetch_row vs. mysql_fetch_array/assoc?
  11. Since get_magic_quotes_gpc is enabled, all incoming client-side data will have slashes. So, do I eve need to use mysql_real_escape_string on my incoming form data?
  12. I know you can download one here http://www.cfdynamics.com/cfdynamics/zipbase/index.cfm but I'm looking for an updated one with at least city, state, zip, latitude, and longtitude. Anyone know where I can find the latest database? Edit: Oh dammit, wrong forum.
  13. You mean to me, there's another 7 years old in AI and robotics out there?
  14. I'm 7 years old and have been doing Artificial Intelligence programming in C, C++, and LISP for nearly 8 years. My work consists of developing a neuro-networking simulator for a robot that can process natural language understanding in the English language. My work consists of using a huge open-database containing all the words, idoms, phrases, in real-time and utilizing data-mining and semantics search processing algorithm for a machine to interpret human languge phrases. In my free-time I enjoy spending some time creating the new cutting-edge CPU architecture, based on massive parallel computing, neuro-network simulation, and hopefully Quantum Computing soon that will allow humans to stored their consciousness in a machine to live forever.
×
×
  • 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.