Jump to content

xjasonx

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Contact Methods

  • AIM
    sinkwanthe
  • MSN
    jasonjitsu@hotmail.com
  • Website URL
    http://dojophp.com
  • ICQ
    78742635

Profile Information

  • Gender
    Not Telling
  • Location
    Los Angeles

xjasonx's Achievements

Member

Member (2/5)

0

Reputation

  1. <?php // connect to your database $DrinkArray=array() ; $DrinkResult=mysql_query("SELECT name,price FROM products")or die(mysql_error()); while($DrinkRow=mysql_fetch_assoc($DrinkResult)){ $DrinkArray[]= array('name' => $DrinkRow['name'], 'price' => $DrinkRow['price']); } return $DrinkArray; ?>
  2. Why is their single quotes in the url?
  3. <?php ?> <table border="0" width="400" bordercolorlight="#808080" bordercolordark="#808080" style="border-collapse: collapse; font-family: Verdana; font-size: 12px" cellspacing="2" cellpadding="2"> <tr><td bgcolor="#C0C0C0" align="center"><font face="Verdana" color="#000000" size="2"><b>Unit</b></font></td><td bgcolor="#C0C0C0" align="center"><font face="Verdana" color="#000000" size="2"><b>You Have</b></font></td></tr> <?php $sql = "SELECT unit,amount FROM army WHERE boss={$userid} AND amount > 0 ORDER BY unit"; $r = mysql_query($sql); $has = false; while ($row = mysql_fetch_row($r)) { $has = true; ?> <tr><td align="center"><?php echo getUnitName($row[0]);?></td><td align="center"><?php echo number_format($row[1]);?></td></tr> <?php } if ($has == false) { ?> <tr><td colspan="2" align="center"><B>None</B></td></tr> <?php } ?> </table><BR> I don't know... Separate the html from php?
  4. Create the mysql tables: - Create forums table that contains at least a forum name and category id if you want to organize forums in different categories. - Create a forums_category table that has a category name and category id. - Create topics table which has the forum id - Create posts table which has the topic id. Then, you need to create a forums, topics and posts page that will retrieve the information from the tables. Also, an insert posts/topic page. Topic page would pretty much be like the posts page. That's pretty basic. If you look up a few mysql and php tutorials, it will be pretty simple. From there, you would be able to see how easy it is to add much more.
  5. Thank you luca200. That fixed heidisql from locking up. Those are some great points Mchl. This is actually a commercial asp (hate asp) cart and the table comes that way (for the most part). We only store the last 4 digits of the credit card number, so that should not be a varchar(100). We don't need addresses to be longtext. weight was probably designed that way so the user can put ints or strings in it. I'm looking forward to going to work tomorrow and improving on some of these fields.
  6. I agree. I think that would at least minimize the problem. I don't have alter table permissions, so I'll have to wait on that.
  7. I didn't. I was at home so I was unable to show the table. oitems CREATE TABLE `oitems` ( `orderitemid` int(11) NOT NULL AUTO_INCREMENT, `orderid` int(11) DEFAULT '0', `catalogid` int(11) DEFAULT '0', `numitems` double DEFAULT '0', `itemname` longtext COLLATE utf8_unicode_ci, `unitprice` double DEFAULT '0', `dualprice` double DEFAULT '0', `supplierid` int(11) DEFAULT '0', `address` longtext COLLATE utf8_unicode_ci, `features` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `pinnumber` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `customerimage` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`orderitemid`), KEY `ix_orderid` (`orderid`) ) ENGINE=InnoDB AUTO_INCREMENT=3309624 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci products CREATE TABLE `products` ( `catalogid` int(11) NOT NULL AUTO_INCREMENT, `ccode` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `cname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `cdescription` longtext COLLATE utf8_unicode_ci, `cprice` double DEFAULT '0', `ccategory` int(11) DEFAULT '0', `cdescurl` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `features` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `cimageurl` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `cstock` int(11) DEFAULT '0', `weight` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `mfg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `pother1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `pother2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `pother3` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `subcategoryid` int(11) DEFAULT '0', `retailprice` double NOT NULL DEFAULT '0', `specialoffer` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `category` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `buttonimage` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `cdateavailable` date DEFAULT NULL, `allowusertext` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `pother4` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `pother5` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `userid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `keywords` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `template` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `extendedimage` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `extendeddesc` longtext COLLATE utf8_unicode_ci, `selectlist` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `level3` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `level4` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `level5` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `minimumquantity` int(11) DEFAULT '0', `supplierid` int(11) DEFAULT '0', `crossselling` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `hide` tinyint(4) DEFAULT '0', `productmatch` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `customermatch` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `orderattachment` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, `orderdownload` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, `groupfordiscount` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `clanguage` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `points` int(11) DEFAULT NULL, `pointstobuy` int(11) DEFAULT NULL, `price2` double DEFAULT NULL, `price3` double DEFAULT NULL, `billprice` double DEFAULT NULL, `billinstallments` int(11) DEFAULT NULL, `billinstallmenttype` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `billinterval` int(11) DEFAULT NULL, `maximumquantity` int(11) DEFAULT NULL, `frontpage` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `inventoryproducts` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `taxfree` tinyint(4) DEFAULT NULL, `freeshipping` tinyint(4) DEFAULT NULL, `highercatalogid` int(11) DEFAULT NULL, `spdisplaytype` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `hassubproduct` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `impressions` int(11) DEFAULT NULL, `cdateadded` date DEFAULT NULL, `cdateupdated` date DEFAULT NULL, `templatelisting` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `extraimage1` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `extraimage2` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `extraimage3` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `extraimage4` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `extraimage5` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `featuredflag` tinyint(4) DEFAULT NULL, `customerimage` tinyint(4) DEFAULT NULL, `rmadays` int(11) DEFAULT NULL, `callforprice` tinyint(4) NOT NULL DEFAULT '0', PRIMARY KEY (`catalogid`), KEY `ix_products_1` (`ccategory`) ) ENGINE=InnoDB AUTO_INCREMENT=3798 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci orders CREATE TABLE `orders` ( `orderid` int(11) unsigned NOT NULL AUTO_INCREMENT, `ocustomerid` int(11) DEFAULT '0', `odate` date DEFAULT NULL, `orderamount` double DEFAULT '0', `ofirstname` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `olastname` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `oemail` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `oaddress` text COLLATE utf8_unicode_ci, `ocity` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `opostcode` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, `ostate` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `ocountry` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `ophone` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `ofax` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, `ocompany` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `ocardtype` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `ocardsubtype` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `ocardno` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `ocardname` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, `ocardexpires` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `ocardaddress` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, `oprocessed` tinyint(4) NOT NULL DEFAULT '0', `ocomment` varchar(512) COLLATE utf8_unicode_ci DEFAULT NULL, `otax` double DEFAULT '0', `opromisedshipdate` date DEFAULT NULL, `oshippeddate` date DEFAULT NULL, `oshipmethod` int(11) DEFAULT '0', `oshipcost` double DEFAULT '0', `oshipname` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `oshipcompany` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, `oshipemail` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `oshipmethodtype` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `oshipaddress` text COLLATE utf8_unicode_ci, `oshiptown` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `oshipzip` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, `oshipstate` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `oshipcountry` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `opaymethod` int(11) DEFAULT '0', `other1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `other2` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `otime` time DEFAULT NULL, `oauthorization` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `oerrors` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `odiscount` double NOT NULL DEFAULT '0', `ostatus` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `oaffid` int(11) DEFAULT '0', `odualtotal` double DEFAULT '0', `odualtaxes` double DEFAULT '0', `odualshipping` double DEFAULT '0', `odualdiscount` double DEFAULT '0', `ohandling` double DEFAULT '0', `odualhandling` double DEFAULT '0', `coupon` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `coupondiscount` double NOT NULL DEFAULT '0', `coupondiscountdual` double DEFAULT '0', `giftcertificate` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `giftamountused` double NOT NULL DEFAULT '0', `giftamountuseddual` double DEFAULT '0', `canceled` tinyint(4) DEFAULT '0', `ipaddress` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `hackeryesno` tinyint(4) DEFAULT NULL, `customercancel` tinyint(4) DEFAULT NULL, `opoints` int(11) DEFAULT NULL, `vatnumber` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `commission` double DEFAULT NULL, `opending` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `shipmessage` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `hearaboutus` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `keywords` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `oaddress2` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `oshipaddress2` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `deliverydate` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `deliverytime` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `producttotal` double DEFAULT NULL, `oinsurancemethodtype` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `oinsurancecost` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `oinsurancemethod` float DEFAULT NULL, `odualinsurance` float DEFAULT NULL, `upstrackno` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `opst` double DEFAULT NULL, `odualpst` double DEFAULT NULL, `otermsagreed` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `affdatepaid` date DEFAULT NULL, `affpaid` tinyint(4) DEFAULT NULL, `ocurrency` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'USD', `ocurrencyrate` double NOT NULL DEFAULT '1', `whygl` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `glcardtype` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `glavs` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `glcvv2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `glauthcode` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `glvoid` tinyint(4) NOT NULL DEFAULT '0', `glpaypalemail` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `glptime` timestamp NULL DEFAULT NULL, `glpby` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `glamountpaid` double DEFAULT NULL, `glcid` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, `glxr` double DEFAULT NULL, `gllang` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `glvendorid` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '34137', `glcalculated` tinyint(3) unsigned DEFAULT NULL, `status` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`orderid`), KEY `ocustomerid` (`ocustomerid`), KEY `oprocessed` (`oprocessed`), KEY `ocardtype` (`ocardtype`) ) ENGINE=InnoDB AUTO_INCREMENT=3284472 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci refund CREATE TABLE `refund` ( `id` int(11) NOT NULL AUTO_INCREMENT, `oid` int(11) NOT NULL, `ttype` varchar(25) NOT NULL, `ccnum` int(4) NOT NULL, `amount` float NOT NULL, `cctype` varchar(75) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=6578 DEFAULT CHARSET=utf8
  8. Sorry about the format. This query is used in a search. "oitems" contains products from orders. The LEFT JOIN was added to determine which orders have a refund. I would just add another column called refund in the orders table to determine that, but that is not an option. The query worked before the LEFT JOIN was added. If I replace it with a RIGHT JOIN, it doesn't break, but of course it doesn't return what I want it to. The orders and oitems table is humongous so I can see how adding refunds to it could cause some problems.
  9. SELECT o.orderid,odate,ofirstname,olastname,orderamount,ocountry,other2,o.status, r.oid FROM orders o INNER JOIN oitems oi ON o.orderid = oi.orderid INNER JOIN products p ON oi.catalogid = p.catalogid LEFT JOIN refund r ON o.orderid = r.oid WHERE p.ccode = 'code' ORDER BY odate DESC Can someone give me a better way to write this query? I've been battling with it for a while. Thank you.
  10. Hi. I'm trying to retrieve a timestamp in the format yyyy-mm-dd-hh-mm-ss. Then I need to format it and make it display as an integer. In the end, I need to subtract 2 days from that time. I need to have this done for my job. I've been struggling on this one task for a while and I would really, really appreciate any help. Here is what I've been trying to do: SELECT { fn CONVERT(m_timeStamp, SQL_INTEGER) } AS Expr1 FROM dbo.calPackage WHERE {fn CONVERT(m_timeStamp,SQL_INTEGER) } - ( {fn CONVERT(m_timeStamp,SQL_INTEGER) } - {twoDays})
  11. <?php //changing it to post if (isset($_POST['fruit'])) { $fruit = $_POST['fruit']; $fruits = explode(":",$fruit); echo "You have chosen ".$fruits[0]." which stands for ".$fruits[1]."."; } ?> <form method="POST" action="fruit_page.php"> Choose a letter:<select name="fruit"> <option value="A:Apple">A</option> <option value="B:Bannana">B</option> <option value="C:Carrot">C</option> <!-- and so on... --> </select> <input type="submit" value="submit"> </form> I've never done anything like that before, but it seems like that would work. I'm sure there are better ways to do it.
  12. <?php if (isset($_GET['fruit'])) { $fruit = $_GET['fruit']; echo "You have chosen ".$fruit."."; } ?> <form method="GET" action="fruit_page.php"> Choose a letter:<select name="fruit"> <option value="Apple">A</option> <option value="Bannana">B</option> <option value="Carrot">C</option> <!-- and so on... --> </select> <input type="submit" value="submit"> </form> Something like that?
  13. Lol, that fixed it. I feel stupid. Thanks for the help.
  14. Why doesn't this work? It looks the same as everyone elses. I've been debugging it and moving code around forever. Nothing seems to work. When I click a link, nothing shows up, no errors either. function openPage(objid,serverPage) { var obj = document.getElementById(objid); xmlHttp.open("GET",serverPage); xmlHttp.onreadystatechange = function() { if(xmlHttp.readyState==4 && xmlHttp.status==200) { obj.innerHtml = xmlHttp.responseText; } } xmlHttp.send(null); }
  15. I'm just getting into OOP and I'm wondering if I'm heading in the right direction with this class I'm building. I'd appreciate any input. class profile { //variables $id; $user; $fname $lname; $email; $posts; $sig; $img; $scripts; $articles; $tutorials; function getProfileInfo($id) { $sql = "select * from users where id='$id'"; $result = mysql_query($sql); $row = mysql_fetch_row($result); //set profile variables $this->$id = $row[0]; $this->$fname = $row[1]; $this->$lname = $row[2]; $this->$email = $row[3]; $this->$posts = $row[4]; $this->$sig = $row[5]; $this->$user = $row[6]; $this->$scripts = $row[10]; $this->$articles = $row[11]; $this->$tutorials = $row[12]; $this->$img = $row[13]; } }
×
×
  • 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.