DevinGn Posted March 11, 2009 Share Posted March 11, 2009 Alright, I have yet another question for you all. I'm using this to run multiple MySQL queries: mysql_query($query); But, this returns the error: Parse error: syntax error, unexpected T_STRING in /home2/depthhos/public_html/host/mysqltest.php on line 111 Here is my line 111: INSERT INTO ".$subdomain."_banner_terms VALUES ('<div align="justify"><strong>Introduction:</strong> This Agreement between you and [sitename] consists of these Terms and Conditions. "You" or "Advertiser" means the entity identified in this enrollment form, and/or any agency acting on its behalf, which shall also be bound by the terms of this Agreement. Please read very carefully these Terms and Conditions.<br /><strong><br />Uses:</strong> You agree that your ads may be placed on (i) [sitename] web site and (ii) Any ads may be modified without your consent to comply with any policy of [sitename]. [sitename] reserves the right to, and in its sole discretion may, at any time review, reject, modify, or remove any ad. No liability of [sitename] and/or its owner(s) shall result from any such decision.<br /><br /></div><div align="justify"><strong>Parties\' Responsibilities:</strong> You are responsible of your own site and/or service advertised in [sitename] web site. You are solely responsible for the advertising image creation, advertising text and for the content of your ads, including URL links. [sitename] is not responsible for anything regarding your Web site(s) including, but not limited to, maintenance of your Web site(s), order entry, customer service, payment processing, shipping, cancellations or returns.<br /><br /></div><div align="justify"><strong>Impressions Count:</strong> Any hit to [sitename] web site is counted as an impression. Due to our advertising price we don\'t discriminate from users or automated robots. Even if you access to [sitename] web site and see your own banner ad it will be counted as a valid impression. Only in the case of [sitename] web site administrator, the impressions will not be counted.<br /><br /></div><div align="justify"><strong>Termination, Cancellation:</strong> [sitename] may at any time, in its sole discretion, terminate the Campaign, terminate this Agreement, or cancel any ad(s) or your use of any Target. [sitename] will notify you via email of any such termination or cancellation, which shall be effective immediately. No refund will be made for any reason. Remaining impressions will be stored in a database and you\'ll be able to request another campaign to complete your inventory. You may cancel any ad and/or terminate this Agreement with or without cause at any time. Termination of your account shall be effective when [sitename] receives your notice via email. No refund will be made for any reason. Remaining impressions will be stored in a database for future uses by you and/or your company.<br /><br /></div><div align="justify"><strong>Content:</strong> [sitename] web site doesn\'t accepts advertising that contains: (i) pornography, (ii) explicit adult content, (iii) moral questionable content, (iv) illegal content of any kind, (v) illegal drugs promotion, (vi) racism, (vii) politics content, (viii) religious content, and/or (ix) fraudulent suspicious content. If your advertising and/or target web site has any of this content and you purchased an advertising package, you\'ll not receive refund of any kind but your banners ads impressions will be stored for future use.<br /><br /></div><div align="justify"><strong>Confidentiality:</strong> Each party agrees not to disclose Confidential Information of the other party without prior written consent except as provided herein. "Confidential Information" includes (i) ads, prior to publication, (ii) submissions or modifications relating to any advertising campaign, (iii) clickthrough rates or other statistics (except in an aggregated form that includes no identifiable information about you), and (iv) any other information designated in writing as "Confidential." It does not include information that has become publicly known through no breach by a party, or has been (i) independently developed without access to the other party\'s Confidential Information; (ii) rightfully received from a third party; or (iii) required to be disclosed by law or by a governmental authority.<br /><br /></div><div align="justify"><strong>No Guarantee:</strong> [sitename] makes no guarantee regarding the levels of clicks for any ad on its site. [sitename] may offer the same Target to more than one advertiser. You may not receive exclusivity unless special private contract between [sitename] and you.<br /><br /></div><div align="justify"><strong>No Warranty:</strong> [sitename] MAKES NO WARRANTY, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION WITH RESPECT TO ADVERTISING AND OTHER SERVICES, AND EXPRESSLY DISCLAIMS THE WARRANTIES OR CONDITIONS OF NONINFRINGEMENT, MERCHANTABILITY AND FITNESS FOR ANY PARTICULAR PURPOSE.<br /><br /></div><div align="justify"><strong>Limitations of Liability:</strong> In no event shall [sitename] be liable for any act or omission, or any event directly or indirectly resulting from any act or omission of Advertiser, Partner, or any third parties (if any). EXCEPT FOR THE PARTIES\' INDEMNIFICATION AND CONFIDENTIALITY OBLIGATIONS HEREUNDER, (i) IN NO EVENT SHALL EITHER PARTY BE LIABLE UNDER THIS AGREEMENT FOR ANY CONSEQUENTIAL, SPECIAL, INDIRECT, EXEMPLARY, PUNITIVE, OR OTHER DAMAGES WHETHER IN CONTRACT, TORT OR ANY OTHER LEGAL THEORY, EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY AND (ii) [sitename] AGGREGATE LIABILITY TO ADVERTISER UNDER THIS AGREEMENT FOR ANY CLAIM IS LIMITED TO THE AMOUNT PAID TO [sitename] BY ADVERTISER FOR THE AD GIVING RISE TO THE CLAIM. Each party acknowledges that the other party has entered into this Agreement relying on the limitations of liability stated herein and that those limitations are an essential basis of the bargain between the parties. Without limiting the foregoing and except for payment obligations, neither party shall have any liability for any failure or delay resulting from any condition beyond the reasonable control of such party, including but not limited to governmental action or acts of terrorism, earthquake or other acts of God, labor conditions, and power failures.<br /><br /></div><div align="justify"><strong>Payment:</strong> You agree to pay in advance the cost of the advertising. [sitename] will not setup any banner ads campaign(s) unless the payment process is complete. [sitename] may change its pricing at any time without prior notice. If you have an advertising campaign running and/or impressions stored for future use for any mentioned cause and [sitename] changes its pricing, you\'ll not need to pay any difference. Your purchased banners fee will remain the same. Charges shall be calculated solely based on records maintained by [sitename]. No other measurements or statistics of any kind shall be accepted by [sitename] or have any effect under this Agreement.<br /><br /></div><div align="justify"><strong>Representations and Warranties:</strong> You represent and warrant that (a) all of the information provided by you to [sitename] to enroll in the Advertising Campaign is correct and current; (b) you hold all rights to permit [sitename] and any Partner(s) to use, reproduce, display, transmit and distribute your ad(s); and (c) [sitename] and any Partner(s) Use, your Target(s), and any site(s) linked to, and products or services to which users are directed, will not, in any state or country where the ad is displayed (i) violate any criminal laws or third party rights giving rise to civil liability, including but not limited to trademark rights or rights relating to the performance of music; or (ii) encourage conduct that would violate any criminal or civil law. You further represent and warrant that any Web site linked to your ad(s) (i) complies with all laws and regulations in any state or country where the ad is displayed; (ii) does not breach and has not breached any duty toward or rights of any person or entity including, without limitation, rights of publicity or privacy, or rights or duties under consumer protection, product liability, tort, or contract theories; and (iii) is not false, misleading, defamatory, libelous, slanderous or threatening.<br /><br /></div><div align="justify"><strong>Your Obligation to Indemnify:</strong> You agree to indemnify, defend and hold [sitename], its agents, affiliates, subsidiaries, directors, officers, employees, and applicable third parties (e.g., all relevant Partner(s), licensors, licensees, consultants and contractors) ("Indemnified Person(s)") harmless from and against any and all third party claims, liability, loss, and expense (including damage awards, settlement amounts, and reasonable legal fees), brought against any Indemnified Person(s), arising out of, related to or which may arise from your use of the Advertising Program, your Web site, and/or your breach of any term of this Agreement. Customer understands and agrees that each Partner, as defined herein, has the right to assert and enforce its rights under this Section directly on its own behalf as a third party beneficiary.<br /><br /></div><div align="justify"><strong>Information Rights:</strong> [sitename] may retain and use for its own purposes all information you provide, including but not limited to Targets, URLs, the content of ads, and contact and billing information. [sitename] may share this information about you with business partners and/or sponsors. [sitename] will not sell your information. Your name, web site\'s URL and related graphics shall be used by [sitename] in its own web site at any time as a sample to the public, even if your Advertising Campaign has been finished.<br /><br /></div><div align="justify"><strong>Miscellaneous:</strong> Any decision made by [sitename] under this Agreement shall be final. [sitename] shall have no liability for any such decision. You will be responsible for all reasonable expenses (including attorneys\' fees) incurred by [sitename] in collecting unpaid amounts under this Agreement. This Agreement shall be governed by the laws of [country]. Any dispute or claim arising out of or in connection with this Agreement shall be adjudicated in [country]. This constitutes the entire agreement between the parties with respect to the subject matter hereof. Advertiser may not resell, assign, or transfer any of its rights hereunder. Any such attempt may result in termination of this Agreement, without liability to [sitename] and without any refund. The relationship(s) between [sitename] and the "Partners" is not one of a legal partnership relationship, but is one of independent contractors. This Agreement shall be construed as if both parties jointly wrote it.</div>', 'Canada'); I imagine it has something to do with the HTML inside? Any help would be much appreciated. Quote Link to comment Share on other sites More sharing options...
Caesar Posted March 11, 2009 Share Posted March 11, 2009 That isn't the complete line in 111 right? Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 11, 2009 Share Posted March 11, 2009 You can't run multiple queries with mysql_query() Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 11, 2009 Share Posted March 11, 2009 your inserting html in a database are you using. htmlspecialchars() Quote Link to comment Share on other sites More sharing options...
DevinGn Posted March 11, 2009 Author Share Posted March 11, 2009 You can't run multiple queries with mysql_query() What would be a way to do so? And that is the entire line. Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 11, 2009 Share Posted March 11, 2009 what do you all mean multiple querys please. i am defiantly confused here. Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 11, 2009 Share Posted March 11, 2009 You should use mysql_query() multiple times. Please show us some more code, because the snippet you gave us is not enough to diagnose a problem. Quote Link to comment Share on other sites More sharing options...
DevinGn Posted March 11, 2009 Author Share Posted March 11, 2009 I'm assuming your forum has a character limit. The entire query is around 9000 lines. Using mysql_query() for every query would certainly take awhile. Do you know of a method to run mulitple queries at the same time? Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 11, 2009 Share Posted March 11, 2009 If you need to insert multiple rows you can use a multi row insert INSERT INTO table(column1, column2, ..., columnn) VALUES (value1, value2, ..., valuen), (value1, value2, ..., valuen), (value1, value2, ..., valuen)... Also be aware that there is a max packet size setting that might prevent you from inserting large amount of data at once. Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 11, 2009 Share Posted March 11, 2009 Oh... and the actual reason you got 'unexpected T_STRING' error is because you have unescaped double quotes in your query align="justify"> should be align=\"justify\"> Quote Link to comment Share on other sites More sharing options...
DevinGn Posted March 11, 2009 Author Share Posted March 11, 2009 Alrighty, no more errors! But, like mentioned before I can not run all the queries with the method I'm using. How can I do this? Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 11, 2009 Share Posted March 11, 2009 http://uk3.php.net/mysqli and look at other database functions/ or database's Quote Link to comment Share on other sites More sharing options...
DevinGn Posted March 11, 2009 Author Share Posted March 11, 2009 I found a function that can run multiple queries separated by semi-colons. Only thing is, I don't completely understand it. Here's the function: function multiple_query($q,$link) { $tok = strtok($q, ";n"); while ($tok) { $results=mysql_query("$tok",$link); $tok = strtok(";n"); } return $results; } I understand $q are all my queries, but could someone explain to me how to use the $link variable? Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 11, 2009 Share Posted March 11, 2009 If you are using only one mysql connection you can safely remove it. Note that this is exactly running mysql_query once for each query in a string, so it's not really efficient. If you want true multiquery capability, move to mysqli. Quote Link to comment Share on other sites More sharing options...
redarrow Posted March 11, 2009 Share Posted March 11, 2009 i posted the correct link that new code you posted wil end up crashing. Quote Link to comment Share on other sites More sharing options...
DevinGn Posted March 12, 2009 Author Share Posted March 12, 2009 Well, I guess I give up. I changed to mysqli and followed all the instructions for mysqli_multi_query, but my database remains blank. I guess I'll have to hire a programmer to do this for me. I apologize for wasting everyone's time. Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 12, 2009 Share Posted March 12, 2009 Perhaps you should tell as what are you aiming at. Knowing this we might suggest an easier way to do it. Quote Link to comment Share on other sites More sharing options...
DevinGn Posted March 12, 2009 Author Share Posted March 12, 2009 I'm going to do my best explain my script the best that I can. What I am making is a PHPNuke automatic creation script, so I can host PHPNuke portals on my website. After the sign up form is submitted the following actions should take place: A sub-domain is generated A folder is created The portal is copied from a specific folder on my server to the user's folder A configuration file is written for each specific user And the user's MySQL tables and rows are written to the database The only part left is the MySQL tables and rows. All the installations point to that single database, so the user's subdomain will also be the table prefix for their installation. (I hope I haven't lost you so far.) The queries that I am trying to run are virtually identical to what you would copy and paste into phpmyadmin. The only differences being that I'm using a variable in front of the table names to act as the prefix, and that I've added the \'s for the rows which have html code inside them. Like I mentioned earlier, there are over 9000 lines of SQL queries that need to be added the database for each installation. Therefore, the methods you mentioned earlier would be quite tedious to use. I hope I've cleared up any confusions. I really do appreciate all your help. -Devin Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 12, 2009 Share Posted March 12, 2009 PHPNuke huh? I am surprised people still want to use it... Quote Link to comment Share on other sites More sharing options...
DevinGn Posted March 12, 2009 Author Share Posted March 12, 2009 Yea. You 'd be surprised. It's mostly used by gaming communities. By the way, i've contacted my host and they do not support mysqli. So any ideas? Quote Link to comment Share on other sites More sharing options...
revraz Posted March 12, 2009 Share Posted March 12, 2009 Get a new host? Quote Link to comment Share on other sites More sharing options...
DevinGn Posted March 12, 2009 Author Share Posted March 12, 2009 Well, I only have 11 months remaining. Until then, there has to be a way to accomplish this. Quote Link to comment Share on other sites More sharing options...
Mchl Posted March 12, 2009 Share Posted March 12, 2009 As I suggested before: If you're inserting many rows into ine table, join them into a multi-row insert. Other than that, you just have to run mysql_query several times. If you're using InnoDB tables, set AUTOCOMMIT to off before inserting, as this will speed things up a lot (don't forget to COMMIT after inserts ;P ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.