Jump to content

niche

Members
  • Content Count

    3,459
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by niche

  1. niche

    Basic Array Question

    That explains a lot!So, please confirm, that the array only exists inside the while loop as $row (in this example)?If so, how can I make it exist outside the loop so I can create some local variables? Thanks.
  2. Based on the last thread, I scripted this and got a blank screen: $query = "SELECT * FROM example"; $result = mysql_query($query);while($row = mysql_fetch_array($result)) {}$ray = is_array($row);echo $ray; Shouldn't this script reurn a "1"Thanks.
  3. niche

    Basic Array Question

    I tested $row with is_array(): $ray = is_array($row);echo $ray; The above script didn't return a "1" so I manually created a simple array to check that I probably understood the is_array() function.That led to believe that the the script, below, didn't produce an array in $row, but you're telling me it did. while($row = mysql_fetch_array($result)){... What do you think?Then I have some more questions that I'd like to continue in a new topic called: Creating An Array From A mysql Table.Thanks.
  4. I have a mysql table called example. It has 3 records and 5 fields. The field names are: id, firstname, lastname, address, and zip.I need to select all the records and place all the info from all the records into an array called myarray.How do I do that?
  5. niche

    Basic Array Question

    Thanks for your help. Here's my script: query = "SELECT * FROM example"; $result = mysql_query($query) or die(mysql_error());while($row = mysql_fetch_array($result)) { echo $row['name']. " - ". $row['age']; echo "<br/>";} Does mysql_fetch_ array create an array or did an array already exist?If so how do I get the name of the array?Also, how do I get other general info about it, or any other array (i.e. number of rows and columns, and column names)?
  6. niche

    Basic Array Question

    I successfully scripted an fetch array while loop on a table called example. What's the name of the function that will return the name of the array that was created by the fetch array while loop?What's the name of the function that will turn the number of rows in an array?Thanks
  7. niche

    Datetime Class

    But, where's the documentation for the argument?
  8. niche

    Datetime Class

    I found this script and don't understand where the argument 'next thursday' came form. I can't find it in the manual for the DateTime class. Shouldn't I be able to find it there? <?php$date = new DateTime('next Thursday');echo $date->format('l, F jS, Y');?> Thanks
  9. niche

    Connecting With Mysqli

    I think I need to work something like this: $result = $mysqli->query($query); into line six, but I'm not sure and don't know how, or have a reference to work from.
  10. niche

    Connecting With Mysqli

    This script works with require_once and produces warnings for line 6 when I try to use $mysqli = new... (which I've commented out). Please help my with this script: <?phprequire_once "connect_to_mysql.php";//$mysqli = new mysqli("localhost","user","pw","db");$result = mysql_query("SELECT * FROM example") or die(mysql_error()); echo "<table border='1'>";echo "<tr> <th>Name</th> <th>Age</th> </tr>";while($row = mysql_fetch_array( $result )) { echo "<tr><td>"; echo $row['name']; echo "</td><td>"; echo $row['age']; echo "</td></tr>"; } echo "</table>";//mysqli_close($mysqli);?> Thank-you
  11. niche

    (!$var)

    So, "(!$name)" is a way of testing whether someone failed to enter their name on a form ( a null name will return a false). Correct? Thanks.
  12. niche

    (!$var)

    Please, what does "(!$var)" mean?I'm pretty sure it means "is $var null".Also, what's the PHP reference?Thanks.
  13. Thanks for the procedural script. I thought about asking for it. So, the long list at: http://www.php.net/manual/en/mysqli.query.php, :: is a method of the class and -> is a method of the object?
  14. Point of information: I found the script I'm using in a book.So, in the line: $result = $mysqli->query($query);, is it accurate to say that query is a method of the $mysqli object, in the mysqli class AND $query satisfies the parameters of the query() method?
  15. I've been reading to get my terminology right.In this example $msqli is an object of the class mysqli and close() (ie $mysqli->close() is a method of the mysqli class.Correct so far?
  16. $mysqli->close() worked. Thank you very much.But, how am I to get "$mysqli->close()" from the reference you provided?What prior knowledge does the reference assume?
  17. I need to import TEST.TXT (located in the same directory as my scriptIt has 1 Record: "6","Lunch","234"Iget this error message: Warning: mysqli_close() expects exactly 1 parameter, 0 given in C:\wamp\www\test\import.php on line 19Why?Heres my script:<?php// Connect to the MySQL server and select the corporate database$mysqli = new mysqli("localhost","user,"password,"test");// Open and parse the test.txt file$fh = fopen("test.txt", "r");while ($line = fgetcsv($fh, 1000, ",")){$id = $line[0];$item = $line[1];$price = $line[2];// Insert the data into the sales table$query = "INSERT INTO example SET id='$id',item='$item', price='$price'";$result = $mysqli->query($query);}fclose($fh);mysqli_close();?>
  18. Can somebody recommend a tutorial about how to create a search function?Thanks.
  19. what is it called when you insert text from a variable in actionscript?
  20. niche

    Card Flip Effect

    Here's an example: http://dl.getdropbox.com/u/560212/Develop%.../Flip/flip.html
  21. niche

    Card Flip Effect

    where can I get an explanation for creating a card flip effect with as2?Thanks
  22. niche

    Mysqli->connect_errno

    I'm obviously going to have to read-up on OOP and PHP/MYSQL.In the meantime, with regards to that 1st line: Why $mysqli instead of $abc?Where does "new mysqli" come from? I don't recognize it as a property of the object (no {}) or a function? Or, should I and if so how/why?Thanks for your help.
  23. niche

    Mysqli->connect_errno

    I'm getting it.So, getting back to the first thread, I have a few more questions about:<?php$mysqli = @new mysqli('localhost', 'fake_user', 'my_password', 'my_db');if ($mysqli->connect_errno) {die('Connect Error: ' . $mysqli->connect_errno);}?>$mysqli is simply a variable in this example right?What is @new mysqli?What is $mysqli->connect_errno (I would say it's a property if it wasn't for the $)?Thank-you
  24. niche

    Mysqli->connect_errno

    You said: There are 2 styles being demonstrated, object-oriented and procedural. In the object-oriented style, connect_errno is not a command or a function, it's a property of the mysqli object. In the procedural style it is a function.Object Oriented Programming (OOP) has been a challanging concept for me, but I've heard it explained using classes.Is OOP and class in CSS the same basic concept?Thank-you
×
×
  • Create New...