Jump to content

NoobNewbie

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

NoobNewbie's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well that may be a good option, GingerRobot! And, then, to adress a specific element from within the multidimensional array I call it like a matrix, something like this... $arrays = array(array('something','somethingelse'),array('anothersomething','somethingmore')); echo $arrays[0][1]; ..and it prints 'somethingelse'. Thanks! It's a great way!
  2. But that will just write the array, right? But what I wanted was to be able to call a specific array and do whatever I want with him. In other languages I do something like this: my_array1 = array("something","something"); my_array2 = array("something","something"); for ($a=0;$a<2;$a++) { print eval('my_array' + $a)[0]; } ..and it will print the first element of my_array1 and the first element of my_array2. I'm not really seing how to do that in php.
  3. Hi Yesideez. Thanks for answering. What I want is to be able to call arrays from within a for cycle. For example: my_array1 = array("something","something"); my_array2 = array("something","something"); my_array3 = array("something","something"); for($a=1;$a<=3;++$a){ //does something with the array that corresponds to $a }
  4. Hello! I'm really new to php and I was wondering if you could help in the following situation. If I have an array called my_array1, how do I call it within a for cycle? Something like this: for($a=1;$a<=5;++$a){ $my_array = 'my_array'.$a; //prints $my_array } I know that doesnt work, so, I tried something like the following: for($a=1;$a<=5;++$a){ $my_array = 'my_array'.$a; //prints $$my_array } That does work with variables, but doesnt work with arrays. I know that in Java and ActionScript what I'm trying to acomplish is pretty simple, but I cant seem to find the correct syntax for php. Help?
  5. Hi! I'm new to php, and I was wondering how can we call variables thorugh a for cycle, for example. Allow me to explain: $var1 = 'Hello'; $var2 = 'Hello again'; for($a=1;$a<=2;++$a){ echo $var.$a; } I thought that it would echo the two variables, but it's echoing 12 instead. I believe its some syntax error, because in other languages we can do that. So, how can we do that?
  6. Thanks a lot! And sorry about the select typo. So, in order to get the id, I need to "store" it in the link in order to use it in the next query. Well, that sounds simple. Thanks!
  7. Hello! First post ever and I believe some of you will laugh at the question but, hey, we go to start somewhere, right? So, I'm really new to MySql and PHP also, but with the help of the almighty Internet I managed to learn a few things. So, my question is actually very simple: how do we know the id of some element in our table in order to do a query? Allow me to explain: for example, we have a table named "people" with 3 columns: "name", "age" and "id". In the html page we click on the name and then I want it to show me the age of that person. So, I thought that we went to php and did something like this: $name = $_POST['name']; query = "SELECT people FROM people_db WHERE name='".$name."'"; $do_it = mysql_query($query); But I found out that that's not a good practice, and what I should do was to do the query based on the id, because it's a unique value on the table. But how do we know what's the id before we do the query? Any help you could provide I'd be gratefull.
×
×
  • 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.