Jump to content

Insert Into Second Table


justlukeyou

Recommended Posts

Hi,

 

Apologies I added another post. As I have had the code working before Im convinced its the dbh variable that is the problem. I have isolated the code and it is still that issue that causes it not to work. Is there away of declaring this against the query so I can run the cron job and then run the seperate code after the database is updated from the data feed?

 

$dbh->commit();

	$dbh->query('UPDATE `furniture_groups` SET `room` = CASE
Link to comment
Share on other sites

$dbh is supposed to be an object of some kind of class. You can't use it until it's instantiated (meaning, the object is created by a line that looks something like $dbh = new Class();). That's what the "non-object" error means: you're trying to use $dbh as an object (as denoted by the -> ), but it's not an object at that point since it hasn't been instantiated.

Link to comment
Share on other sites

Yes my previous code appled the dbh to the query which inserts the datafeed into the table. How can instantiate it. Can I say that the contents from the query = the dbh ?

No.

 

You need to learn the basics of OOP. Time to stop randomly throwing code at the problem and start thinking like a developer. We've all given you the tools over the past few years. Now it's up to you to use them and take the next step in your development.

 

I'm not trying to be rude or difficult, but this particular problem you're facing is just a symptom of your reluctance to learn. None of us are simply going to give you working code. You have the ability to figure this out on your own, especially after all of the things we have told you and shared. I've already given you a list of things to test and check and the name of a couple tools to do it in a professional and efficient way in this very thread.

 

So, good luck with your problem. I actually sincerely hope you solve it own your own. Between everything we've told you and official documentation (which we all know you hate, but you'll have to learn to handle it if you're going to do this), you have all you need in order to succeed. And nothing feels quite so good as actually getting it.

Link to comment
Share on other sites

Hi,

 

I also tried this.  Can run two queries together?

 

 

mysql_connect($host, $username, $password);
mysql_select_db($database);


$query = mysql_query("SELECT * FROM furniture_groups ");
while($row = mysql_fetch_array($query)) {


echo $row['long_name']; 
 
 
$query = mysql_query('UPDATE `furniture_groups` SET `room` = CASE
WHEN `long_name` LIKE \'%kitchen%\' THEN \'Kitchen\'
Link to comment
Share on other sites

I just need to get this working. Im not a coder, I dont want to be coder and I dont want to pay someone $80 to redo code which I previously had working.

 

Can you advise what I need to do?

You can't have it both ways. Either you need to learn how to fix it yourself, which we have given you the tools to do, or you need to pay someone to do it. $80 is an hour or two of work, so it's not like it's an exorbitant fee.

Link to comment
Share on other sites

1. My name is Kevin, not Keith.

 

2. You paid for code that worked. That transaction is complete and is separate from your current problem.

 

3. How would you know how long an experienced coder would take at this task? Experienced coders take the time to test their code to squash bugs and double check that things work. And, regardless, you do understand how freelancing works, don't you? You are not a charity case, nor are you somehow more inherently special than any other potential client out there. As a freelancer myself, I have to charge for at least an hour's worth of work for something trivial because I have my own bills to pay and don't have a consistent salary.

 

Frankly, as a freelancer, I find your attitude to be a bit insulting. You don't deserve to have another person's skill and effort for free. What we do here is help people who want to learn how to do this. Since you clearly don't, you're wasting everyone's time.

 

Again, you can't have it both ways. You either need to pay the cost of the time it takes to learn how to do this yourself, or you need to pay cash for someone else to do this. Welcome to the real world.

Link to comment
Share on other sites

1) Rounding up to the nearest 15m, 30m or 1h increment is standard practice. You'll find this in most service based industries, not just coding.

 

2) You don't know what the issue is or what's involved in fixing it, so it's pretty presumptuous of you to decide how long it should take to fix

 

3) Even if it only takes an experienced person 3m to fix something, point is, you can't do it yourself. It's like in Kill Bill when Uma spent years training to break a board with his fist from like 1 inch away. You'd cheapening her expertise by saying "So what, she just broke a board." Point is, getting to the point of being able to solve something in like 3 minutes takes a lot of time and effort, and you're being very disrespectful and cheapening things by claiming those 3 minutes worth of work is nothing more than 3 minutes worth of work. Why should you pay "lots of money" for it? You used (but entirely missed the point of) the keyword in your own statement: experienced. The value you are getting is that you don't have to go through all the time and effort to be able to solve it in 3 minutes.

 

4) "It worked before so i know it works" really? My car was working last week so I know it works. Yesterday it broke down. Things change, shit happens. At best, you're just pointing out the obvious. At worst, you're being pretentious.

 

5) "I already paid for the code.." And? wtf does that have to with not paying for fixing it now? Let me call up a mechanic and tell him I shouldn't have to pay him for his services on my broken car, since I already paid for the car. Do..do you see how silly that is? Maybe the person/company you bought it from offers support for it; have you tried there? But thinking some other random person shouldn't be paid for their work is just stupid.

 

Kevin summed it up nicely:

 

Again, you can't have it both ways. You either need to pay the cost of the time it takes to learn how to do this yourself, or you need to pay cash for someone else to do this. Welcome to the real world.

Link to comment
Share on other sites

Apologies Kevin for getting your name wrong.

 

Got the code working. Many thanks for everyones help. I wish I had $80 to regularly spend on code. I have a full time job but haven't had a pay rise in 4 years. I have been flipping books on Amazon which has been going for the last 4 weeks. Hopefully thay will continue to grow.

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.