Software Development and Programming Careers (Official Discussion Thread)

kevm3

follower of Jesus
Supporter
Joined
May 2, 2012
Messages
16,300
Reputation
5,571
Daps
83,590
You're right, thanks for pointing that out.

However, I still get the same error. :/ I'll keep working on it.
Post out the full error for us. Kind of hard to tell what it's complaining about
 

kevm3

follower of Jesus
Supporter
Joined
May 2, 2012
Messages
16,300
Reputation
5,571
Daps
83,590
With regards to my post above...

I'm trying to create a while loop that gets data from two seperate database tables. When it does, it does a subtraction between a column from both tables. It checks if the result is over the "limit". If it's not, it prints out a coloumn data from the row.

Here's my code:
Code:
http://pasteguru.com/18798

I get an error in line 15 saying: "mysql_fetch_array() expects parameter 1 to be resource, boolean given in..."

Can someone tell me where I'm going wrong or how to better excute this code?

I'm thinking it may be the $num variable in your if condition. I don't see it defined anywhere,.

It could also be your while statement that is causing the problem. It looks like you are using the assignment operator '=' instead of the comparison operator ==.

Try
while($row1 == mysql_fetch_array($result1) && $row2 == mysql_fetch_array($res2))
 
Last edited:

Milk

Pro
Joined
Sep 27, 2015
Messages
661
Reputation
390
Daps
1,624
Reppin
England
Try changing && to || in line 11 so it displays an error when either of the queries is false.
And in line 15 try adding parenthesis like the following:
Code:
while(($row1 = mysql_fetch_array($result1)) && ($row2 = mysql_fetch_array($res2)))
Thanks, I'll make that change to my code.

Post out the full error for us. Kind of hard to tell what it's complaining about
Just to let you know, this task is part of my coursework, so I had change the variable names of my code because I don't want it searchable on the internet.

I'll PM if need be.

I'm thinking it may be the $num variable in your if condition. I don't see it defined anywhere,.

It could also be your while statement that is causing the problem. It looks like you are using the assignment operator '=' instead of the comparison operator ==.

Try
while($row1 == mysql_fetch_array($result1) && $row2 == mysql_fetch_array($res2))

Thanks for pointing this out, I'll make the changes.

Let me work on the code (alone) for a while and I'll get back to you guys.
 
Last edited:

Milk

Pro
Joined
Sep 27, 2015
Messages
661
Reputation
390
Daps
1,624
Reppin
England
@kevm3 @Eissek

Will you guys be online on this Sunday?

I'm planning on completing the task on Sunday and I wanted to get some quick response from you two when I'm stuck on a problem. Will that be possible?
 

Jx2

Veteran
Joined
May 28, 2012
Messages
13,672
Reputation
3,921
Daps
66,908
Reppin
NULL
Hey guys, been awhile since I've posted in here. I want to get back into coding and back into a project that I've been working on. I want to delve back into javascript/sql database management stuff and am getting ready to purchase a new laptop that I'm going to keep solely for coding and managing my music booking business.

I've been doing some research for a bit and thought I was going to settle on a macbook pro. After a little more digging I've come to the conclusion that I think a Macbook Air with 8gb ram will serve me well. Can anyone tell me if you think this is a bad idea or would this properly suit my needs like I'm thinking it will. Any feedback from you guys would be greatly appreciated. I miss the days of learning languages and building from scratch:mjcry:
 

kevm3

follower of Jesus
Supporter
Joined
May 2, 2012
Messages
16,300
Reputation
5,571
Daps
83,590
Hey guys, been awhile since I've posted in here. I want to get back into coding and back into a project that I've been working on. I want to delve back into javascript/sql database management stuff and am getting ready to purchase a new laptop that I'm going to keep solely for coding and managing my music booking business.

I've been doing some research for a bit and thought I was going to settle on a macbook pro. After a little more digging I've come to the conclusion that I think a Macbook Air with 8gb ram will serve me well. Can anyone tell me if you think this is a bad idea or would this properly suit my needs like I'm thinking it will. Any feedback from you guys would be greatly appreciated. I miss the days of learning languages and building from scratch:mjcry:

Buy whatever machine is going to be most comfortable for you and will actually have you sitting down and coding
 

Milk

Pro
Joined
Sep 27, 2015
Messages
661
Reputation
390
Daps
1,624
Reppin
England
I should be on
Thank you.

I'm making some progress with my code, here.

It runs, but it prints a "Notice: Undefined variable: row2 in" error in line 16. After that line it prints 12,997 line list of row names, when there's only 300 in my database. Now, I do want it to print out a list of row names (like I defined in my echo statement), but 12,997 rows isn't right. It should only be selecting rows that have a "num" under or equals to 20.
 

KritNC

All Star
Joined
Jun 5, 2012
Messages
3,440
Reputation
610
Daps
4,085
Reppin
Costa Rica
I think I'm going to get heavy into data structures and algorithms and mathematics soon. I already know enough languages decently enough. Time to really focus on the knowledge that spans across languages.
Hows the new job going?`
 

kevm3

follower of Jesus
Supporter
Joined
May 2, 2012
Messages
16,300
Reputation
5,571
Daps
83,590
Thank you.

I'm making some progress with my code, here.

It runs, but it prints a "Notice: Undefined variable: row2 in" error in line 16. After that line it prints 12,997 line list of row names, when there's only 300 in my database. Now, I do want it to print out a list of row names (like I defined in my echo statement), but 12,997 rows isn't right. It should only be selecting rows that have a "num" under or equals to 20.

Where is $row2 being defined in the code?
 

kevm3

follower of Jesus
Supporter
Joined
May 2, 2012
Messages
16,300
Reputation
5,571
Daps
83,590
Hows the new job going?`

Can't complain too much about it so far. It's really making me focus on my front-end skills, which weren't as sharp as they needed to be. How is yours going?
 

Milk

Pro
Joined
Sep 27, 2015
Messages
661
Reputation
390
Daps
1,624
Reppin
England
Where is $row2 being defined in the code?
Thanks. What I did was put a * (select all) in the query, so the $row2 can pick up its easting variable.

There's no error message now, but there's no result on screen (no row names returned).

I'll keep on working on this and send you an update once I've figured it out.
 

kevm3

follower of Jesus
Supporter
Joined
May 2, 2012
Messages
16,300
Reputation
5,571
Daps
83,590
Thanks. What I did was put a * (select all) in the query, so the $row2 can pick up its easting variable.

There's no error message now, but there's no result on screen (no row names returned).

I'll keep on working on this and send you an update once I've figured it out.

ON c.idNum = p.iNum

change that p.iNum to p.idNum and see if anything changes
 
Top