Jump to content

Whats the function to do this?


ballhogjoni

Recommended Posts

what is the int?

 

is it a number of entries in a db?

 

if so you can do this:

$sql="SELECT * FROM table";
$result=mysql_query($query); 
$int=mysql_num_rows($result);
$a = range(1,$int);
print_r($a);

 

if you were more specific as to where you were getting your number that would help...

 

 

Don't take this the wrong way, but that's a horrible way to do that.

 

 

SELECT COUNT(*) FROM table;

 

Would be many times faster.

 

Why select everything when you just want to count it?

Link to comment
Share on other sites

because i am stupid, duh!

no...i am pretty new to the coding thing, just a hobby...starting to get a handle on php, still not too good w/mysql.  just basics.  i appreciate it when someone points out something that works better/faster/smarter.  i have noticed that even if i can get something done, someone else can get it done in at least half the time, if not less...either way, the idea was there and he got a crappy way and a good way to do it.

 

use the good way!  i know i will from now on.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.