Jump to content

Search the Community

Showing results for tags 'MySQL'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

  1. I HAD TO RUN resetroot.bat IN MYSQL DIRECTORY WHEN I LOST MY root user account. NOW ALL IS REDEEMED BUT I CANT SEEM TO SET MY root password. SOMEONE SHOULD PLS HELP OUT.
  2. HELLO, PLEASE I NEED TO CONNECT TO A MYSQL SERVER NOT ON MY COMPUTER. I REALLY NEED TO WORK WITH THE DATABASE ON A PROJECT AM DOING. HOW DO I GO ABOUT THIS?
  3. HELLO,PLS, I UNKNOWINGLY DELETED MY "ALL PRIVILEGES" ACCOUNT IN MySQL. RIGHT NOW I CANT CREATE DB, VIEW DB/TABLES. I CANT DO NOTHING JUST LOOK IN THERE. WHAT CAN I DO PLS, IN ORDER TO GAIN CONTROL BACK OF MySQL ACCOUNT. IT MEANS A LOT IF YOU CAN HELP.
  4. i want to know how to sum the numbers returned from a php query of mysql data. please guide through...
  5. sulove

    ASP.NET with MySql

    Hi all, I have 2 question need you help explain as below. Could we built ASP.NET Webform and use database with MySQL insteat of SQL Server? Could I hosting this project if I select Windows Platform on Godaddy.com? Thanks.
  6. i'm trying to select columns with multiple conditions. i want to select all 'tr_type' for all 'aid's but not 'SALES' & 'PURCHASE' for aid in '1' & '2'. i tried --- SELECT * FROM tran WHERE aid NOT IN ('1','2') AND tr_type IN ('SALES','PURCHASE') ORDER BY date it didn't work. please suggest....
  7. i came to learn that future and past dates are calculated with the simple use of "strtotime()". but this is calculated in relating with current date. i want to know if a future date can be calculated in relation with database stored date? for example, if '2014-01-01' is stored in database, how can i get the date of 30 days(i.e.-2014-01-30) ahead from this date?
  8. how can i loop a result from a php function to loop through each 'id'? like for all 'sid's, i want to use following function to get data... /* above this i calculate value for each $cqty */$cqty = $oqty + $inqty - $outqty;$camt = "select date, pqty, prate, pamt from stock stjoin purchase p on st.sid = p.sid where st.sid = $sidunion allselect date, -sqty, srate, samt from stock stjoin sales s on st.sid = s.sid where st.sid = $sidunion allselect null, oqty, oprice, oamt from stock where sid = $sidorder by date asc";$dataSet = array();$camtresult = mysqli_query($connect, $camt);while ($row = mysqli_fetch_array($camtresult)){ $dataSet[] = $row;}function camt($dataSet, $cqty){ $totalPurchaseValue = 0; $totalPurchaseQty = 0; $done = false; foreach($dataSet as $row) { // skip sales rows if ($row['pqty'] < 0) { continue; } for ($i=0; $i<$row['pqty']; $i++ ) { $totalPurchaseQty++; $totalPurchaseValue += $row['prate']; if ($totalPurchaseQty == $cqty) { return $totalPurchaseValue; } } } return $totalPurchaseValue;}// Determine the $countOfGoodsForSale$crate = camt($dataSet, $cqty) / $cqty;$camt = $cqty*$crate; i tried while loop but it said--- please guide through
  9. i am trying to command mysql to sum until it reaches certain value from my table 'purchase', for each 'sid' starting from the last row, i need sum of 'pqty' until the result equals a value from string (but to try i've given a certain value). let me define with the rows from my table--- the rows for 'sid=1' from 'purchase' are like this--- from this row, starting from the last row i want to 'sum(pqty) until it reaches 19(for now). it is achieved from adding last 2 rows(for 19). and stop sum here and return valus or sum of 'pqty', 'prate' and 'pamt'. to achieve this i tried the following SELECT date, pqty, @total := @total + pqty AS total FROM (purchase, (select @total :=0) t) WHERE @total<19 AND sid = $sid ORDER BY date DESC but it's not working. please guide me through this. also suggest something else if this is not the good technique for my purpose. thankz in advance.....
  10. why these lines are not working? $sql3 = "SELECT *,sum(amt),sum(qty) FROM purchase WHERE sid=$sid AND pvn!=0 ORDER BY pvn DESC LIMIT 2";$result3 = mysqli_query($connect, $sql3) or die(mysqli_error($connect));$row3 = mysqli_fetch_array($result3);echo $row3['sum(qty)'] . "<br />";$sql4 = "SELECT *,sum(amt),sum(qty) FROM purchase WHERE sid=$sid AND pvn!=0 ORDER BY pvn DESC LIMIT 3";$result4 = mysqli_query($connect, $sql4) or die(mysqli_error($connect));$row4 = mysqli_fetch_array($result4);echo $row4['sum(qty)'] . "<br />"; they both SELECT result from the complete rows on 'purchase' table. please guide what is wrong in it!
  11. funbinod

    confusing JOIN

    i'm trying to JOIN 2 tables and get their data on a single html table to display customer LEDGER REPORT. but a lot of tries made me hopeless. please create some hope on me. what i want to do is like ---- | date | sales | receipt | balance | |--------------- |-- -------- |------------- |-------------| | 2014/03/01 | $5000 | (blank) | $5000 | | 2014/03/03 | (blank) | $3000 | $2000 | | 2014/03/25 | (blank) | $1400 | $500 | -------------------------------------------------------- | TOTAL | $5000 | $3000 | $500 | -------------------------------------------------------- and it orders by DATE. i wish it take all the 'date's from both tables and order data by 'date'. and then in each html row display sales amount and receipt amount alternately according to date. edit: explaining more clearly - if the date is from 'sales' field then display sales on sales column(on html table) and leave the receipt column blank and same for receipt. both "sales" and "receipt" tables have 'cid', 'date', amount' i tried all JOIN types. but perhaps i know less, i couldn't make it done.
  12. juice

    php and mysql

    im creating a simple website and database for a project with minimal functionality. All i'm supposed to do is create a website that communicates with a database. i chose to do that project with php, ajax and mysql in xamp. Now i've decided to work on the database first, i want it to be portable where i can just put the completed code in folder on a flash drive and go to school with it. where i'll jus be able to copy it to the htdocs folder in the xamp and it will automatically create the database and run all the queries. For some reason, no matter what i try it won't show up in the phpmyadmin databases section. I desperately need help, i wanna kno if my idea is possible and how can i go about it.. here's my code.. thanks much to any help, will be greatly appreciated.. the config.php <?php$db_name="dscdb";$db_user="root";$db_password="";$db_server="localhost";?> heres my connection mysqlconnection.php <?phpinclude($_SERVER['DOCUMENT_ROOT'].'/FinalProject/config.php');$con=mysql_connect($db_server,$db_user,$db_password) or die("Connection Failure: ".mysql_error());mysql_select_db($db_name,$con); ?> and heres my database and query creation.. setup.php <?phpinclude($_SERVER['DOCUMENT_ROOT'].'/Finalproj/config.php');{$con = mysql_connect($db_server,$db_user,$db_password); // database connect//Database creation mysql_query("CREATE DATABASE IF NOT EXISTS $db_name" $con) or die("creating database fails".mysql_error()); USE $db_name; mysql_select_db($db_name) or die(mysql_error()); //Students Table creation mysql_query("CREATE Table IF NOT EXISTS 'Students'('StudID' varchar NOT NULL (15) , primary key (StudentID), 'FirstName' varchar(15) NOT NULL, 'LastName' varchar (15) NOT NULL, 'BirthDate' DATE NOT NULL, 'Address' varchar(30) NOT NULL, 'MajorTitle' Foreign key (MajorTitle) References Majors(MajorTitle) NOT NULL, 'Username' varchar(15) NOT NULL, 'Password' varchar(8) NOT NULL)") or die("Failed to create Table".mysql_error()); mysql_query($con,"INSERT into Students(StudID, FirstName, LastName, BirthDate, Address, MajorTitle, Username, Password) values ('123', 'lee', 'daniel', '1990-01-08', 'Bioche', 'Computer Science', 'lee', 'daniel')"); mysql_query($con,"INSERT into Students(StudID, FirstName, LastName, BirthDate, Address, MajorTitle, Username, Password) values ('456', 'danphil', 'daniel', '1992-06-25', 'Bioche', 'Electronics', 'danphil', 'daniel')"); mysql_query($con,"INSERT into Students(StudID, FirstName, LastName, BirthDate, Address, MajorTitle, Username, Password) values ('789', 'eber', 'raver', '1988-03-28', 'Colihaut', 'Physics', 'eber', 'raver')") //$hashedpassword=sha1("password");// Instructor Table creation mysql_query("CREATE Table IF NOT EXISTS 'Instructors'('InstrucID' varchar NOT NULL (15), primary key (InstrucID), 'FirstName' varchar (15) NOT NULL, 'LastName' varchar (15) NOT NULL, 'Address' varchar(30) NOT NULL, 'Username' varchar (15) NOT NULL, 'Password' varchar(8) NOT NULL) ") or die("Failed to create Table".mysql_error()); mysql_query($con,"INSERT into Instructors(InstrucID, FirstName, LastName, Address, Username, Password) values ('abc', 'larry', 'thomas', '1982-09-14', 'Goodwill', 'larry', 'thomas')"); mysql_query($con,"INSERT into Instructors(InstrucID, FirstName, LastName, Address, Username, Password) values ('def', 'james', 'victor', '1986-09-06', 'Grandbay', 'james', 'victor')"); mysql_query($con,"INSERT into Instructors(InstrucID, FirstName, LastName, Address, Username, Password) values ('ghi', 'barnaby', 'jack', '1977-11-23', 'ireland', 'barnaby', 'jack')");//Registrar Table creation mysql_query("CREATE Table IF NOT EXISTS 'Registrars' ('RegID' varchar NOT NULL (15), primary key(RegID), LastName varchar (15) NOT NULL, Username varchar (15) NOT NULL, Password varchar(15) NOT NULL) ") or die("Failed to create Table".mysql_error()); mysql_query($con,"INSERT into Registrars(RegID, LastName, Username, Password) values ('abc123', 'jones', 'jones', 'jones')"); //Majors table creation mysql_query("CREATE Table IF NOT EXISTS 'Majors' ('MajorType' varchar NOT NULL (15), primary key (MajorID), 'MajorTitle' varchar (20) NOT NULL)") or die("Failed to create Table".mysql_error()); mysql_query($con,"INSERT into Majors('MajorType', 'MajorTitle') values ('FAS', 'Computer Science')"); mysql_query($con,"INSERT into Majors('MajorType', 'MajorTitle') values ('FAS', 'Physics')"); mysql_query($con,"INSERT into Majors('MajorType', 'MajorTitle') values ('FAAT', 'Electronics')"); echo "<script>alert('The webApp has been installed successfully')</script> "; mysql_close();}}?>
  13. Ok so I have been looking for how to do this all day(Very long time) and I can't find it anywhere. What I am trying to do is power my website with what I call URL variables the things that YouTube uses E.G. Page.php?video=1 but when it comes to selecting data from my database I have an issue. I have a table for ID and some others I will call them EX1 to EX5, what I am trying to do is the URL "?" thing says a number and that number is turned into a variable(don't know how) but that variable indicates the ID, but I don't want to put the ID on the page, I want the ID to tell my PHP code where in the tables the EX1 - EX5 are, so they can become a variable for later use on the page. Sum up. PHP takes the URL?name=1 turns into variable(1) - variable indicates where in the columns to look LOOKS UNDER ID finds 1 - now it needs to make the EX1 - EX5 in the same column into variables. ID EX1 EX2..... 1 I don't know how to do this can anyone help me?
  14. i got problem somewhere while trying to authenticate users while loging in. what i wrote to authenticate in classuser file is this-- // start authentication $safeUser = $mysqli->real_escape_string($username); $incomingPass = $mysqli->real_escape_string($password); $query = "SELECT * FROM user WHERE username = '{$safeUser}'"; if (!$result = $mysqli->query($query)) { error_log("Cannot retrieve account record for {$username}"); return false; } // no while loop for single row $row = $result->fetch_assoc(); $dbPass = $row['password']; if (crypt($incomingPass, $dbPass) != $dbPass) { error_log("Wrong Password for {$username}!"); return false; } i've mysql table 'user' and columns 'username' & 'password'. while trying loging in with valid username & password also it gives username & password related error. both username & password are recorded in CHAR(10) type.....
  15. Okay I'm biulding a website for a client which is required to do the following: Financial Advisor's from the company i am working for needs to be able to login to the website (by creating a account using a code unique to the company). Then be able to add client infomation to their own client list on a database (seperate from other advisors). From there the Advisors need to be able to go back and see a simplified list of their clients (i.e. just the clients name for example with a search option to find clients easily). Then when the click on the client's name they will be taken to a different page which displays the client's information in full, with the ability to edit this information. I understand the difficulty of this task and my skills are more directed towards the design aspect of websites, as you can probably make out I have little experince with databases and PHP, however I have taught myself other computer languages and not worried about the need to learn. All i'm asking for is for someone to outline what needs to be done and point me in the right direction as to where I can aquire the knowledge needed to complete this project. Thanks a million Ieuan.
  16. i'm trying to make a install script. for that i wish to CREATE a DATABASE and at the same time CREATE some TABLEs for it with a single form submit? for this can DATABASE be selected within the "CREATE TABLE" query? if yes how? or there is any other idea?
  17. funbinod

    mysql to mysqli

    got difficulty on converting mysql to mysqli to these line <?php// select table$query = "SELECT * FROM vender";$result = mysql_query($query);if (!$result) die("Unable to select database: " . mysqli_error());// fetch data$rows = mysql_num_rows($result);for ($n = 0 ; $n < $rows ; ++$n){ echo "<option>" . mysql_result($result,$n,'vname') . "</option>" ;}?> please guide....
  18. i tried this $TotalSales = mysql_fetch_array($sales);$TotalReceipts = mysql_fetch_array($receipt);$TotalBalance = $TotalSales - $TotalReceipts;echo $TotalBalance; what is the problem????
  19. funbinod

    edit a record

    (feeling a bit difficult to describe) i am trying to edit a post on a mysql table. in it data is transferred from one row to previous data was recorded for "ID-1" and now data on some cell should be transferred to "ID-2" and that makes change to another table also. i succeeded to change data on another table and change on "ID-2". but i got difficulties to retrieve "ID-1" to change its value. the edit form is like this --- <form method ="POST" action="saleseditpost.php"><fieldset><legend><h1>Edit Sales Record</h1></legend><div class="form-field"><label>Customer Name:</label><select name="cname" id="cname"><option></option> <?php // select table $query = "SELECT * FROM customer"; $result = mysql_query($query); if (!$result) die("Unable to select database: " . mysqli_error()); // fetch data $rows = mysql_num_rows($result); for ($n = 0 ; $n < $rows ; ++$n) { echo "<option>" . mysql_result($result,$n,'cname') . "</option>" ; } ?></select> </div> <div class="form-field"> <label>S.N.: </label> <input type="text" name="sn" id="sn" value="<?php echo $rs-> sn ?>" readonly="readonly"> </div> <div class="form-field"> <label for="date">Date: </label> <input type="text" name="date" id="date" value="<?php echo $rs-> date ?>"> </div> <div class="form-field"> <label for="ref">Ref.No.: </label> <input type="text" name="ref" id="ref" value="<?php echo $rs-> ref ?>"> </div> <div class="form-field"> <label for="amt">Bill Amount: </label> <input type="text" name="amt" id="amt" value="<?php echo $rs-> amt ?>"> </div> <div class="form-field"> <input type="submit" value="EDIT" name="submit" id="submit"> </div></fieldset></form> the name selected from the <select> option is "ID-2". data retrieved through "$rs->" is for "ID-1". now when the edit form is submitted input name - "amt" is stored for "ID-2" and previous data "$rs-> amt" must be erased from "ID-1". i succeeded to store input "amt" to ID-2 but not succeeded to erase that from ID-1. actually i could not retrieve ID-1 i want to learn how to grab that previous ID? i used action script like this --- // grab cid from cname$resultcid = mysql_query("SELECT cid FROM customer WHERE cname = '$cname'");$rowcid = mysql_fetch_array($resultcid);$cid = $rowcid['cid'];// grab balance from customer$chkBal = "SELECT * FROM customer WHERE cname = '$cname'";$result = mysql_query($chkBal) or die(mysql_error());while($myRows = mysql_fetch_array($result)) {$balance = $myRows['bal'];$newBalance = $balance + $amt;$preSales = $myRows['sales'];$newSales = $preSales + $amt;}// grab s.n.$sn = ($_POST['sn']);$sql = "SELECT * FROM customer where cid = '$cid' ";$result = mysql_query($sql);$rs = mysql_fetch_object($result);$date = strtoupper($_POST['date']);$ref = strtoupper($_POST['ref']);$amt = strtoupper($_POST['amt']);$sql2= "UPDATE sales SET sn = '$sn',cid = '$cid',date = '$date',ref = '$ref',amt = '$amt' WHERE sn ='$sn'";$sql3= "UPDATE customer SET sales = '$newSales',bal = '$newBalance' WHERE cid ='$cid'";mysql_query($sql2)or die(mysql_error()); mysql_query($sql3)or die(mysql_error());
  20. funbinod

    duplicate entry

    how to check for duplicate entry on a form using php?
  21. expensiveal

    Help PHP error

    Hii'am new in this forum yesterday i created an Affilatereferral program with PHP Fixthewindows.combut i'am getting an errorParse error: syntax error, unexpected '=', expecting ')' in /home/u479191455/public_html/common.php on line 9The code of common.phpcommon.phpin Dreamweaver CC i'am getting more errorsError Line : 9 , 10 , 11 , 12 , 13 , 14 , 15 , 17 ,24 , , 60 , 61,62,63,64,66 Please Help !
  22. i want to know if jquery (or javascript) can deal with mysql database?
  23. am very fresh in php and whatever i learnt is from w3schools. i am trying to create invoice script. for this i wish if automatic display of "item name" & "price" by entering just "item code" be possible. there is a table for stock item with rows "item code", "item name", "price". please guide me. thank u.
  24. i created loop for selecting from all the rows of a table like this--- <?$rows = mysql_num_rows($result);for ($n = 0 ; $n < $rows ; ++$n) { echo '' . mysql_result($result,$n,'item') . '<br />'; }?> and tried to put in dropdown menu like this ---- echo '<form action="#" id="test" name="test">';echo '<select name="item">';echo "<option></option>";echo "<option>";{echo '' . mysql_result($result,$n,'item') . '<br />';}echo "</option>";echo '</select>';echo '</form>'; but returned error "Warning: mysql_result(): Unable to jump to row 2 on MySQL result index 5 in .................................." please guide me....
  25. how to make a dropdown menu on a FORM with the datas from a column of a database table like items from all rows of a "MEMBERS" table's "NAME" column
×
×
  • Create New...