|
|
This line
$output = "Tracking Number: $tracking_number<br />Order Number: $sales_order_number<br />Parts: $parts";
I need whatever $tracking_number outputs to become a hyperlink for google search with the outputted number search.
Example
The database outputs
Tracking Number: 923489234 <=This number needs to be a blue hyperlink link to google search with that number search
Order Number: 234324
Parts: 30405324
Once that tracking number is search in google, google determines what carrier it is saves me allot of trouble. I wish it was this simple $output = "Tracking Number: $tracking_number link google.com/search?q=$tracking_number any ideas guys. Thanks
The rest of my code is below if you want to view it.
<?php
$output = NULL;
if(isset($_POST['submit'])){
$mysqli = NEW MySQLi("","","","");
$search = $mysqli->real_escape_string($_POST['search']);
$resultSet = $mysqli->query("SELECT * FROM invlist WHERE sales_order_number = '$search'");
if($resultSet->num_rows > 0){
while($rows = $resultSet->fetch_assoc())
{
$tracking_number = $rows['tracking_number'];
$sales_order_number = $rows['sales_order_number'];
$parts = $rows['parts'];
$output = "Tracking Number: $tracking_number<br />Order Number: $sales_order_number<br />Parts: $parts";
}
}else{
$output = "No results";
}
}
?>
<form method="POST">
<input type="TEXT" name="search" />
<input type="SUBMIT" name="submit" value="Search" />
</form>
<?php echo $output; ?>
|
|
|
|
|
Google shows URL's from the sites it has crawled. To become part of the search-results, they URL's must be submitted to Google.
Ask Google to recrawl your URLs - Search Console Help[^]
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
somebody said to add this but it does not seem to be working
$output += "<br><a href="https:
|
|
|
|
|
Of course it didn't. Google doesn't read your code. If your link appears on the web, and that location is indexed, then that URL will be indexed.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I think we are getting crossed here on what I need.
I have a searchable database that I created, when you enter the order number it outputs this information
Tracking Number:
Order Number:
Parts:
-----------------------
Ok lets say
my database yielded these results
Tracking Number: 123219843
Order Number: 9432
Parts: 234923
Since the database yielded Tracking Number: 123219843 I need to have that number thrown over to google to be searched by google. so it needs to become a link. I dont want to have to phyiscally copy and paste the tracking number into google.
|
|
|
|
|
If you want your link to show up, you have to submit it, or a page containing those links.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
What do you mean by "not working"? If it generates a link that looks like:
<a href="https://www.google.com/search?q=123219843">Search</a> then it should work: Search
Depending on the tracking code, it might not find the results you want. But it will open a Google search for the tracking code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
well i tried inserting this code
$output += "<br><a href="https:
into
$output = "Tracking Number: $tracking_number<br />Order Number: $sales_order_number<br />Parts: $parts";
and it keeps crashing my search box.
|
|
|
|
|
I don't know what "crashing my search box" means.
I notice you're overwriting the $output variable for each record. Does your search only ever return a single result?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
correct.
i tried doing this
$output = "Tracking Number: $tracking_number<br />$output += "<br><a href="https://google.com/search?q=$tracking_number">Search</a>";Order Number: $sales_order_number<br />Parts: $parts";
but it did not work
|
|
|
|
|
How about:
$output = "Tracking Number: $tracking_number<br /><a href=\"https://google.com/search?q=$tracking_number\">Search</a><br />Order Number: $sales_order_number<br />Parts: $parts"; NB: You need to escape the quotes inside the string.
PHP: Strings - Manual[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
that did it thanks so much
|
|
|
|
|
Hi,
I am trying to copy just the Headers of a result set of a select statement, normally I am able to do by select only one row, but I want to get it even if the Resultset has empty rows. Please need some help. - Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
For SQL Server Management Studio (SSMS) you can go to Tools | Options
Within Options: Query Results | SQL Server | Results to Grid
When you can select a row, copy it and you get the headers (plus the selected rows).
Unless, you only have one column or you have an empty result set - then it doesn't work.
You can either (1) change your result to text [CTRL]+"D" and see the headings
(also Tools | Options | Query Results | SQL Server | General, select Results to Grid)
or (2) you can select the "Include the query in the result set" (though presumably you already have the query).
Hope that helps,
-Chris C.
|
|
|
|
|
Try
Select * from Table where 1=1
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually its not a problem of where condition, because where 1=1 is nothing but not having where clause itself like
Select * from Employee is same as Select * from Employee where 1=1
The table itself doesn't have any data but still I want to copy the Header names as there are 45 Columns in that table for example and i don't want to expand the Columns of the table in Management studio in that way I can do, but just want get it from select resultset.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
You want to explore the Information_Schema views
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Country'
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah that makes sense - thanks a lot
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
My original question was, "What should I name the clustered index column which isn't the primary key?" but then I started putting in why I was doing it, and changed the subject to include 'is this a good idea?'
I have a table and the primary key is a GUID, which is generated from vendor code so I cannot do what I would normally do: create an int for the clustered index and use that as the pk.
My idea is to create the table like this:
CREATE TABLE [dbo].[table_name](
[need_a_good_name_here] [int] IDENTITY(-1,-1) NOT NULL, -- Adding this field
[guid] [char](36) NOT NULL PRIMARY KEY NONCLUSTERED,
...
) ON [PRIMARY]
CREATE CLUSTERED INDEX Ix_Table_Name ON [dbo].[table_name] ([need_a_good_name_here] ASC) Feel free to comment on the following:
1. I don't want the guid to be the clustered index because there will be inserts.
There were 3,000 inserts the first month, and I'm expanding from one category to four five. No way to know the distribution of inserts (except 1st shift / business days) and I don't know the frequency of the other categories.
Fill factor == 100, not sure I can get it changed.
2. I have the identity starting at -1 and decreasing by 1 to make it obvious that it isn't the pk.
Don't know how much this will help, but I do what I can.
3. I don't like the names ix_need_a_good_name_here, need_a_good_name_here_ix, need_a_good_name_here_id, because if I saw them I would assume that was the primary key. Suggestions?
4. Should I just not worry about splits?
5. Remember my mention of vendor code... I can't use SQL Server NEWSEQUENTIALID() which would make #1 a non-issue.
All feedback appreciated!
modified 24-Apr-18 17:23pm.
|
|
|
|
|
JChrisCompton wrote:
CREATE TABLE [dbo].[table_name](
[need_a_good_name_here] [int] IDENTITY(-1,-1) NOT NULL,
[guid] [char](36) NOT NULL PRIMARY KEY NONCLUSTERED,
...
) ON [PRIMARY]
May I ask why you are using char rather than uniqueidentifier type?
|
|
|
|
|
Good question... 3rd party software is the reason.
|
|
|
|
|
JChrisCompton wrote: 2. I have the identity starting at -1 and decreasing by 1 to make it obvious that it isn't the pk.
Don't know how much this will help, but I do what I can. If it is your table, you decide what the PK is. The vendors ID should simply be a unique constraint with an index and be treated as an "alternative primary key".
JChrisCompton wrote: 3. I don't like the names ix_need_a_good_name_here, need_a_good_name_here_ix, need_a_good_name_here_id, because if I saw them I would assume that was the primary key. Suggestions? The name should be identifying enough for you to know which constraint has been broken once the exception is thrown. To make searching easier, I use the tablename as the beginning of that name, and postfix the columname on which the constraint lies, as well as the letters "IX" for an index, or "C" for a constraint.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
JChrisCompton wrote: 1. I don't want the guid to be the clustered index because there will be inserts.
There were 3,000 inserts the first month, and I'm expanding from one category to four. No way to know the distribution of inserts (except 1st shift / business days) and I don't know the frequency of the other categories.
Fill factor == 100, not sure I can get it changed. 3000 inserts is really not much.
JChrisCompton wrote: 2. I have the identity starting at -1 and decreasing by 1 to make it obvious that it isn't the pk.
Don't know how much this will help, but I do what I can. The best identifier is a proper name, see Eddys response I agree fully with him. And so does ISO 11179.
JChrisCompton wrote: 3. I don't like the names ix_need_a_good_name_here, need_a_good_name_here_ix, need_a_good_name_here_id, because if I saw them I would assume that was the primary key. Suggestions? I believe you're mixing up indexes with keys.
The purpose of an index is to speed up the searching of a table, an index does not need to be unique.
The purpose of a key is to ensure the integrity of the database. A key needs an index for the function, but not the other way around.
If you create a clustered table, you should not use a guid as the key as you really should avoid random inserts on them. so either you use the identity column as the primary key and simply put a unique key on the guid column, or you use a nonclustered table.
|
|
|
|
|
> I believe you're mixing up indexes with keys.
Perhaps - let me try again; maybe I didn't convey this well.
The index isn't just for lookup speed, it is a unique index (same functionality as a unique constraint unless I'm missing something... I'm more of an 'app dba' than a 'real DBA') to enforce referential integrity because... referential integrity.
The addition of the Identity field was due to my concern about page splits. The guid will remain the primary key for the table. The guid is generated within a vendor's application so there isn't much I can do about that at the moment.
I know (or at least 'think') that fill factor is only applied at rebuild or creation. This troubled me since guids are random (in the sense that where a newly generated guid falls numerically in relation to an existing list of guids is a random position). Inserts will fill up any fill factor <100 and then splits start (and the splits are equivalent to fill factor = 100 as the table grows).
So I came up with the idea of a Clustered Identity as the 'physical sorting field' (numerically increasing won't generate page split) because it seems a better idea than (1) guid inserts causing page splits, and (2) better than making the table a heap (without a clustered index).
Someone mentioned the volume being low. Yes, last month was 3,000 but this will be expanded from 1 to 5 categories. This could cause 3,100 entries next month or 31,000 entries. I don't have the time of day of the inserts but it is all first shift and (I think) mostly at the start of the month. If I can cause less work for the db, it feels like I should.
One new piece of information that I'll share: testing this I don't see as much of a negative impact from a pk clustered guid as I expected.
|
|
|
|