Posts: 1,464
Threads: 90
Joined: Aug 2009
Reputation:
0
Hi there,
I can't seem to find the function, or how to create a row, and checking if it exists. If it does, then it doesn't create the row, but if it doesn't it does create the row.
I tried with mysql_num_rows...but shortly after that I released that wasn't going to work.
Posts: 1,464
Threads: 90
Joined: Aug 2009
Reputation:
0
Well...I don't think selecting from rows with specific values is gonna help...it would also be a big pain in the ass.
Posts: 6,129
Threads: 36
Joined: Jan 2009
Run a select query with the conditions of your query and then use mysql_num_rows, if a result equal to 0 is returned, allow the query to process.
Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by The Toni
Ah okay. Thanks Calgon.
I'll edit, and post a Code i'll make rl fast.
EDIT:
pawn Код:
function CreateBusiness(Bizzname[], price, Float:EnterX, Float:EnterY, Float:EnterZ) { format(str, sizeof(str), "SELECT * FROM `bizzinfo`"); mysql_query(str); mysql_store_result(); if(mysql_num_rows() != 0) format(str, sizeof(str), "INSERT INTO `bizzinfo` (BizzName, Owner, Price, PayAmount, EntX, EntY, EntZ) VALUES ('%s', 'For Sale', %d, 5000, %f, %f, %f)", Bizzname, price, EnterX, EnterY, EnterZ); mysql_query(str); mysql_free_result(); return 1; }
This is all I had. This still lets me create more then 1 of the same business.
|
I said with the conditions, you need to execute a query like this:
SELECT * FROM `bizzinfo` WHERE x, y, z, blah, blah blah
Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by The Toni
Well yeah... I know what you mean. But wouldn't I need to do different coordinates for every business I add?
|
I don't understand what you're trying to do. If you're trying to ensure certain values aren't the same, then use the select w/ the where conditionals in your query.